diff options
| author | Tom Lane | 2001-10-12 00:07:15 +0000 |
|---|---|---|
| committer | Tom Lane | 2001-10-12 00:07:15 +0000 |
| commit | f9e6e27c873bcf50fdc20f5a28c5bede66d18f25 (patch) | |
| tree | f6514d7b7c968982c25b00008c43289c6e2df1e1 /src/include | |
| parent | e98476eb032bd4dc32ca97212b660cad0bbadef4 (diff) | |
Break transformCreateStmt() into multiple routines and make
transformAlterStmt() use these routines, instead of having lots of
duplicate (not to mention should-have-been-duplicate) code.
Adding a column with a CHECK constraint actually works now,
and the tests to reject unsupported DEFAULT and NOT NULL clauses
actually fire now. ALTER TABLE ADD PRIMARY KEY works, modulo
having to have created the column(s) NOT NULL already.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/command.h | 4 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 11 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/include/commands/command.h b/src/include/commands/command.h index 7eb1a4fab84..78aa06a2dfb 100644 --- a/src/include/commands/command.h +++ b/src/include/commands/command.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: command.h,v 1.27 2001/05/07 00:43:25 tgl Exp $ + * $Id: command.h,v 1.28 2001/10/12 00:07:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -56,7 +56,7 @@ extern void AlterTableDropColumn(const char *relationName, int behavior); extern void AlterTableAddConstraint(char *relationName, - bool inh, Node *newConstraint); + bool inh, List *newConstraints); extern void AlterTableDropConstraint(const char *relationName, bool inh, const char *constrName, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index e190fb20bbb..44961bcca94 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.145 2001/10/02 21:39:36 tgl Exp $ + * $Id: parsenodes.h,v 1.146 2001/10/12 00:07:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -187,6 +187,12 @@ typedef struct CopyStmt /* ---------------------- * Create Table Statement + * + * NOTE: in the raw gram.y output, ColumnDef, Constraint, and FkConstraint + * nodes are intermixed in tableElts, and constraints is NIL. After parse + * analysis, tableElts contains just ColumnDefs, and constraints contains + * just Constraint nodes (in fact, only CONSTR_CHECK nodes, in the present + * implementation). * ---------------------- */ typedef struct CreateStmt @@ -196,8 +202,7 @@ typedef struct CreateStmt List *tableElts; /* column definitions (list of ColumnDef) */ List *inhRelnames; /* relations to inherit from (list of * T_String Values) */ - List *constraints; /* constraints (list of Constraint and - * FkConstraint nodes) */ + List *constraints; /* constraints (list of Constraint nodes) */ bool istemp; /* is this a temp table? */ bool hasoids; /* should it have OIDs? */ } CreateStmt; |
