diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/commands/tablecmds.c | 2 | ||||
-rw-r--r-- | src/backend/parser/gram.y | 26 |
2 files changed, 9 insertions, 19 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 29ca7c9369c..afb25007613 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -12199,7 +12199,7 @@ ATExecAlterConstrInheritability(List **wqueue, ATAlterConstraint *cmdcon, colName = get_attname(currcon->conrelid, colNum, false); /* - * Propagate the change to children. For SET NO INHERIT, we don't + * Propagate the change to children. For this subcommand type we don't * recursively affect children, just the immediate level. */ children = find_inheritance_children(RelationGetRelid(rel), diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 271ae26cbaf..0fc502a3a40 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -2662,15 +2662,19 @@ alter_table_cmd: n->subtype = AT_AlterConstraint; n->def = (Node *) c; c->conname = $3; - c->alterDeferrability = true; + if ($4 & (CAS_DEFERRABLE | CAS_NOT_DEFERRABLE | + CAS_INITIALLY_DEFERRED | CAS_INITIALLY_IMMEDIATE)) + c->alterDeferrability = true; + if ($4 & CAS_NO_INHERIT) + c->alterInheritability = true; processCASbits($4, @4, "FOREIGN KEY", &c->deferrable, &c->initdeferred, - NULL, NULL, NULL, yyscanner); + NULL, NULL, &c->noinherit, yyscanner); $$ = (Node *) n; } - /* ALTER TABLE <name> ALTER CONSTRAINT SET INHERIT */ - | ALTER CONSTRAINT name SET INHERIT + /* ALTER TABLE <name> ALTER CONSTRAINT INHERIT */ + | ALTER CONSTRAINT name INHERIT { AlterTableCmd *n = makeNode(AlterTableCmd); ATAlterConstraint *c = makeNode(ATAlterConstraint); @@ -2683,20 +2687,6 @@ alter_table_cmd: $$ = (Node *) n; } - /* ALTER TABLE <name> ALTER CONSTRAINT SET NO INHERIT */ - | ALTER CONSTRAINT name SET NO INHERIT - { - AlterTableCmd *n = makeNode(AlterTableCmd); - ATAlterConstraint *c = makeNode(ATAlterConstraint); - - n->subtype = AT_AlterConstraint; - n->def = (Node *) c; - c->conname = $3; - c->alterInheritability = true; - c->noinherit = true; - - $$ = (Node *) n; - } /* ALTER TABLE <name> VALIDATE CONSTRAINT ... */ | VALIDATE CONSTRAINT name { |