mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add IF NOT EXISTS processing to ALTER TABLE ADD COLUMN
Fabrízio de Royes Mello, reviewed by Payal Singh, Alvaro Herrera and Michael Paquier.
This commit is contained in:
@ -1942,6 +1942,16 @@ alter_table_cmd:
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_AddColumn;
|
||||
n->def = $2;
|
||||
n->missing_ok = false;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> ADD IF NOT EXISTS <coldef> */
|
||||
| ADD_P IF_P NOT EXISTS columnDef
|
||||
{
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_AddColumn;
|
||||
n->def = $5;
|
||||
n->missing_ok = true;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> ADD COLUMN <coldef> */
|
||||
@ -1950,6 +1960,16 @@ alter_table_cmd:
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_AddColumn;
|
||||
n->def = $3;
|
||||
n->missing_ok = false;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> ADD COLUMN IF NOT EXISTS <coldef> */
|
||||
| ADD_P COLUMN IF_P NOT EXISTS columnDef
|
||||
{
|
||||
AlterTableCmd *n = makeNode(AlterTableCmd);
|
||||
n->subtype = AT_AddColumn;
|
||||
n->def = $6;
|
||||
n->missing_ok = true;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
/* ALTER TABLE <name> ALTER [COLUMN] <colname> {SET DEFAULT <expr>|DROP DEFAULT} */
|
||||
|
Reference in New Issue
Block a user