diff options
author | Andrew Dunstan | 2006-06-16 20:23:45 +0000 |
---|---|---|
committer | Andrew Dunstan | 2006-06-16 20:23:45 +0000 |
commit | bbcd01692bff099117f5afb0fe2d1ad182621766 (patch) | |
tree | 07aebd51aac35be3e0e4471cbff7595a35350d67 /src/backend/commands/tablespace.c | |
parent | e79cc2db00501fb29e3e0225182147192e830fa1 (diff) |
DROP ... IF EXISTS for the following cases:
language, tablespace, trigger, rule, opclass, function, aggregate. operator, and cast.
Diffstat (limited to 'src/backend/commands/tablespace.c')
-rw-r--r-- | src/backend/commands/tablespace.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index bafea91dfcb..17dcf9f3a51 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.34 2006/03/29 21:17:38 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.35 2006/06/16 20:23:44 adunstan Exp $ * *------------------------------------------------------------------------- */ @@ -403,10 +403,25 @@ DropTableSpace(DropTableSpaceStmt *stmt) tuple = heap_getnext(scandesc, ForwardScanDirection); if (!HeapTupleIsValid(tuple)) - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("tablespace \"%s\" does not exist", - tablespacename))); + { + if ( ! stmt->missing_ok ) + { + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("tablespace \"%s\" does not exist", + tablespacename))); + } + else + { + ereport(NOTICE, + (errmsg("tablespace \"%s\" does not exist ... skipping", + tablespacename))); + /* XXX I assume I need one or both of these next two calls */ + heap_endscan(scandesc); + heap_close(rel, NoLock); + } + return; + } tablespaceoid = HeapTupleGetOid(tuple); |