1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

ALTER TABLE ... ALTER CONSTRAINT for FKs

Allow constraint attributes to be altered,
so the default setting of NOT DEFERRABLE
can be altered to DEFERRABLE and back.

Review by Abhijit Menon-Sen
This commit is contained in:
Simon Riggs
2013-06-29 00:27:30 +01:00
parent 2f74e4ec50
commit f177cbfe67
6 changed files with 205 additions and 0 deletions

View File

@ -1943,6 +1943,21 @@ alter_table_cmd:
n->def = $2;
$$ = (Node *)n;
}
/* ALTER TABLE <name> ALTER CONSTRAINT ... */
| ALTER CONSTRAINT name ConstraintAttributeSpec
{
AlterTableCmd *n = makeNode(AlterTableCmd);
Constraint *c = makeNode(Constraint);
n->subtype = AT_AlterConstraint;
n->def = (Node *) c;
c->contype = CONSTR_FOREIGN; /* others not supported, yet */
c->conname = $3;
processCASbits($4, @4, "ALTER CONSTRAINT statement",
&c->deferrable,
&c->initdeferred,
NULL, NULL, yyscanner);
$$ = (Node *)n;
}
/* ALTER TABLE <name> VALIDATE CONSTRAINT ... */
| VALIDATE CONSTRAINT name
{