Change Constraint structure to be a full node structure.

Add new constraint types PRIMARY, UNIQUE.
This commit is contained in:
Thomas G. Lockhart 1997-12-04 23:55:52 +00:00
parent 77356a7fc1
commit dc88e795d1
1 changed files with 70 additions and 67 deletions

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parsenodes.h,v 1.36 1997/12/04 00:28:03 scrappy Exp $
* $Id: parsenodes.h,v 1.37 1997/12/04 23:55:52 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@ -82,7 +82,7 @@ typedef struct AddAttrStmt
NodeTag type;
char *relname; /* the relation to add attr */
bool inh; /* add recursively to children? */
struct ColumnDef *colDef; /* the attribute definition */
Node *colDef; /* the attribute definition */
} AddAttrStmt;
/* ----------------------
@ -130,23 +130,25 @@ typedef struct CreateStmt
{
NodeTag type;
char *relname; /* the relation to create */
List *tableElts; /* column definitions list of ColumnDef */
List *tableElts; /* column definitions list of Column */
List *inhRelnames; /* relations to inherit from list of Value
* (string) */
List *constraints; /* list of constraints (ConstaintDef) */
} CreateStmt;
typedef enum ConstrType
typedef enum ConstrType /* type of constaints */
{
CONSTR_NONE, CONSTR_CHECK /* type of constaints */
CONSTR_NONE, CONSTR_NOTNULL, CONSTR_DEFAULT, CONSTR_CHECK, CONSTR_PRIMARY, CONSTR_UNIQUE
} ConstrType;
typedef struct ConstraintDef
typedef struct Constraint
{
ConstrType type;
NodeTag type;
ConstrType contype;
char *name; /* name */
void *def; /* definition */
} ConstraintDef;
void *keys; /* list of primary keys */
} Constraint;
/* ----------------------
* Create/Drop TRIGGER Statements
@ -725,6 +727,7 @@ typedef struct ColumnDef
TypeName *typename; /* type of column */
bool is_not_null; /* flag to NOT NULL constraint */
char *defval; /* default value of column */
List *constraints; /* constraints on column */
} ColumnDef;
/*