1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Improve ALTER DOMAIN / DROP CONSTRAINT with nonexistent constraint

ALTER DOMAIN / DROP CONSTRAINT on a nonexistent constraint name did
not report any error.  Now it reports an error.  The IF EXISTS option
was added to get the usual behavior of ignoring nonexistent objects to
drop.
This commit is contained in:
Peter Eisentraut
2012-01-05 19:48:55 +02:00
parent 2abefd9a92
commit 104e7dac28
10 changed files with 45 additions and 5 deletions

View File

@ -7616,6 +7616,18 @@ AlterDomainStmt:
n->typeName = $3;
n->name = $6;
n->behavior = $7;
n->missing_ok = false;
$$ = (Node *)n;
}
/* ALTER DOMAIN <domain> DROP CONSTRAINT IF EXISTS <name> [RESTRICT|CASCADE] */
| ALTER DOMAIN_P any_name DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
{
AlterDomainStmt *n = makeNode(AlterDomainStmt);
n->subtype = 'X';
n->typeName = $3;
n->name = $8;
n->behavior = $9;
n->missing_ok = true;
$$ = (Node *)n;
}
/* ALTER DOMAIN <domain> VALIDATE CONSTRAINT <name> */