Re: cuando creo una tabla quiero añadir un campo int4 nombrado cflavia "al vuelo"

From: "lein gutierrez" <leing2002(at)gmail(dot)com>
To: "lein gutierrez" <leing2002(at)gmail(dot)com>, pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: cuando creo una tabla quiero añadir un campo int4 nombrado cflavia "al vuelo"
Date: 2006-06-02 22:03:01
Message-ID: 9023caba0606021503k2745eb86hf04bbdae5d7caa14@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Te entendi la idea introduje en el parsenodes.h esto:

typedef struct CreateStmt
{
NodeTag type;
RangeVar *relation; /* relation to create */
List *tableElts; /* column definitions (list of ColumnDef)
*/
List *inhRelations; /* relations to inherit from (list of
* inhRelation) */
List *constraints; /* constraints (list of Constraint nodes) */
ContainsOids hasoids; /* should it have OIDs? */
OnCommitAction oncommit; /* what do we do at COMMIT? */
char *tablespacename; /* table space to use, or NULL */

/* nuevo lein */
char *colname; /* name of column */
TypeName *typename; /* type of column */
} CreateStmt;

En el gram.y:

CREATE OptTemp TABLE qualified_name '(' OptTableElementList ')' AS VALID
EVENT
OptInherit OptWithOids OnCommitOption OptTableSpace
{
CreateStmt *n = makeNode(CreateStmt);
$4->istemp = $2;
n->relation = $4;
n->tableElts = $6;
n->inhRelations = $11;
n->constraints = NIL;
n->hasoids = $12;
n->oncommit = $13;
n->tablespacename = $14;
n->colname = "cflavia";
n->typename = "int4";
$$ = (Node *)n;
}

estA bien me crea la tabla asi
postgres=# CREATE TABLE mitabla4 (mientero int) AS VALID EVENT ;
CREATE TABLE

Al consultarla espero dos campos, pero sale:

postgres=# SELECT * FROM mitabla4 ;
mientero
----------
(0 rows)

Alguna sugerencia ?

Saludos, Lein

El día 2/06/06, Alvaro Herrera <alvherre(at)commandprompt(dot)com> escribió:
>
> lein gutierrez escribió:
>
> > Me da el siguiente error
> > gram.y:1734: error: 'CreateStmt' has no member named 'colname'
> > gram.y:1735: error: 'CreateStmt' has no member named 'typename'
>
> parsenodes.h
>
> --
> Alvaro Herrera
> http://www.CommandPrompt.com/
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
>

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2006-06-02 22:22:22 Re: cuando creo una tabla quiero añadir un campo int4 nombrado cflavia "al vuelo"
Previous Message Carlos Alberto Cianci 2006-06-02 21:41:05 Re: Funcion que no retorna un valor