diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-15 19:05:11 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2011-06-15 19:06:36 -0400 |
commit | d988d92bf0603cdf07a57f57f53a28caf5e951f5 (patch) | |
tree | 3161dd5e59fea02bde0097bb1c50a92e7b692138 /src/include/nodes/parsenodes.h | |
parent | 3cfecae3a34853c631eeb75671c6b82638e8e0aa (diff) |
Rework parsing of ConstraintAttributeSpec to improve NOT VALID handling.
The initial commit of the ALTER TABLE ADD FOREIGN KEY NOT VALID feature
failed to support labeling such constraints as deferrable. The best fix
for this seems to be to fold NOT VALID into ConstraintAttributeSpec.
That's a bit more general than the documented syntax, but it allows
better-targeted syntax error messages.
In addition, do some mostly-but-not-entirely-cosmetic code review for
the whole NOT VALID patch.
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r-- | src/include/nodes/parsenodes.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 14937d4363e..c65e3cd6e8c 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -1221,7 +1221,7 @@ typedef enum AlterTableType AT_DropInherit, /* NO INHERIT parent */ AT_AddOf, /* OF <type_name> */ AT_DropOf, /* NOT OF */ - AT_GenericOptions, /* OPTIONS (...) */ + AT_GenericOptions /* OPTIONS (...) */ } AlterTableType; typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */ @@ -1234,7 +1234,6 @@ typedef struct AlterTableCmd /* one subcommand of an ALTER TABLE */ * constraint, or parent table */ DropBehavior behavior; /* RESTRICT or CASCADE for DROP cases */ bool missing_ok; /* skip error if missing? */ - bool validated; } AlterTableCmd; @@ -1469,8 +1468,9 @@ typedef struct CreateStmt * * If skip_validation is true then we skip checking that the existing rows * in the table satisfy the constraint, and just install the catalog entries - * for the constraint. This is currently used only during CREATE TABLE - * (when we know the table must be empty). + * for the constraint. A new FK constraint is marked as valid iff + * initially_valid is true. (Usually skip_validation and initially_valid + * are inverses, but we can set both true if the table is known empty.) * * Constraint attributes (DEFERRABLE etc) are initially represented as * separate Constraint nodes for simplicity of parsing. parse_utilcmd.c makes @@ -1544,7 +1544,7 @@ typedef struct Constraint char fk_upd_action; /* ON UPDATE action */ char fk_del_action; /* ON DELETE action */ bool skip_validation; /* skip validation of existing rows? */ - bool initially_valid; /* start the new constraint as valid */ + bool initially_valid; /* mark the new constraint as valid? */ } Constraint; /* ---------------------- @@ -2417,7 +2417,7 @@ typedef enum VacuumOption VACOPT_VERBOSE = 1 << 2, /* print progress info */ VACOPT_FREEZE = 1 << 3, /* FREEZE option */ VACOPT_FULL = 1 << 4, /* FULL (non-concurrent) vacuum */ - VACOPT_NOWAIT = 1 << 5 + VACOPT_NOWAIT = 1 << 5 /* don't wait to get lock (autovacuum only) */ } VacuumOption; typedef struct VacuumStmt |