mirror of
https://github.com/postgres/postgres.git
synced 2025-09-08 00:47:37 +03:00
DROP IF EXISTS for columns and constraints. Andres Freund.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.670 2009/07/16 06:33:43 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.671 2009/07/20 02:42:28 adunstan Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -1610,6 +1610,16 @@ alter_table_cmd:
|
||||
n->def = (Node *) makeString($6);
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> DROP [COLUMN] IF EXISTS <colname> [RESTRICT|CASCADE] */
|
||||
| DROP opt_column IF_P EXISTS ColId opt_drop_behavior
|
||||
{
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_DropColumn;
|
||||
n->name = $5;
|
||||
n->behavior = $6;
|
||||
n->missing_ok = TRUE;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> DROP [COLUMN] <colname> [RESTRICT|CASCADE] */
|
||||
| DROP opt_column ColId opt_drop_behavior
|
||||
{
|
||||
@@ -1617,6 +1627,7 @@ alter_table_cmd:
|
||||
n->subtype = AT_DropColumn;
|
||||
n->name = $3;
|
||||
n->behavior = $4;
|
||||
n->missing_ok = FALSE;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/*
|
||||
@@ -1640,6 +1651,16 @@ alter_table_cmd:
|
||||
n->def = $2;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> DROP CONSTRAINT IF EXISTS <name> [RESTRICT|CASCADE] */
|
||||
| DROP CONSTRAINT IF_P EXISTS name opt_drop_behavior
|
||||
{
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_DropConstraint;
|
||||
n->name = $5;
|
||||
n->behavior = $6;
|
||||
n->missing_ok = TRUE;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> DROP CONSTRAINT <name> [RESTRICT|CASCADE] */
|
||||
| DROP CONSTRAINT name opt_drop_behavior
|
||||
{
|
||||
@@ -1647,6 +1668,7 @@ alter_table_cmd:
|
||||
n->subtype = AT_DropConstraint;
|
||||
n->name = $3;
|
||||
n->behavior = $4;
|
||||
n->missing_ok = FALSE;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> SET WITH OIDS */
|
||||
|
Reference in New Issue
Block a user