1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +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

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.64 2006/03/05 15:58:24 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.65 2006/06/16 20:23:44 adunstan Exp $
*
*-------------------------------------------------------------------------
*/
@ -396,9 +396,18 @@ DropProceduralLanguage(DropPLangStmt *stmt)
CStringGetDatum(languageName),
0, 0, 0);
if (!HeapTupleIsValid(langTup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("language \"%s\" does not exist", languageName)));
{
if (! stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("language \"%s\" does not exist", languageName)));
else
ereport(NOTICE,
(errmsg("language \"%s\" does not exist ... skipping",
languageName)));
return;
}
object.classId = LanguageRelationId;
object.objectId = HeapTupleGetOid(langTup);