1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +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

@ -425,7 +425,15 @@ AlterSequence(AlterSeqStmt *stmt)
List *owned_by;
/* Open and lock sequence. */
relid = RangeVarGetRelid(stmt->sequence, AccessShareLock, false);
relid = RangeVarGetRelid(stmt->sequence, AccessShareLock, stmt->missing_ok);
if (relid == InvalidOid)
{
ereport(NOTICE,
(errmsg("relation \"%s\" does not exist, skipping",
stmt->sequence->relname)));
return;
}
init_sequence(relid, &elm, &seqrel);
/* allow ALTER to sequence owner only */