1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-17 17:02:08 +03:00

ALTER <thing> [IF EXISTS] ... allows silent DDL if required,

e.g. ALTER FOREIGN TABLE IF EXISTS foo RENAME TO bar

Pavel Stehule
This commit is contained in:
Simon Riggs
2012-01-23 23:25:04 +00:00
parent 4993a49b7c
commit b8a91d9d1c
19 changed files with 534 additions and 52 deletions

View File

@ -2283,7 +2283,15 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString)
* new commands we add after this must not upgrade the lock level
* requested here.
*/
rel = relation_openrv(stmt->relation, lockmode);
rel = relation_openrv_extended(stmt->relation, lockmode, stmt->missing_ok);
if (rel == NULL)
{
/* this message is consistent with relation_openrv */
ereport(NOTICE,
(errmsg("relation \"%s\" does not exist, skipping",
stmt->relation->relname)));
return NIL;
}
/* Set up pstate and CreateStmtContext */
pstate = make_parsestate(NULL);