1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

DROP ... IF EXISTS for the following cases:

language, tablespace, trigger, rule, opclass, function, aggregate. operator, and cast.
This commit is contained in:
Andrew Dunstan
2006-06-16 20:23:45 +00:00
parent e79cc2db00
commit bbcd01692b
15 changed files with 271 additions and 58 deletions

View File

@ -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);