From b8a91d9d1c7ec75aaecf13df687ec7b5b0ed35a6 Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Mon, 23 Jan 2012 23:25:04 +0000 Subject: ALTER [IF EXISTS] ... allows silent DDL if required, e.g. ALTER FOREIGN TABLE IF EXISTS foo RENAME TO bar Pavel Stehule --- src/backend/parser/parse_utilcmd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/backend/parser/parse_utilcmd.c') diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 99157c53493..f1a108a9828 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -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); -- cgit v1.2.3