summaryrefslogtreecommitdiff
path: root/src/backend/commands/opclasscmds.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2006-06-16 20:23:45 +0000
committerAndrew Dunstan <andrew@dunslane.net>2006-06-16 20:23:45 +0000
commitbbcd01692bff099117f5afb0fe2d1ad182621766 (patch)
tree07aebd51aac35be3e0e4471cbff7595a35350d67 /src/backend/commands/opclasscmds.c
parente79cc2db00501fb29e3e0225182147192e830fa1 (diff)
downloadpostgresql-bbcd01692bff099117f5afb0fe2d1ad182621766.tar.gz
DROP ... IF EXISTS for the following cases:
language, tablespace, trigger, rule, opclass, function, aggregate. operator, and cast.
Diffstat (limited to 'src/backend/commands/opclasscmds.c')
-rw-r--r--src/backend/commands/opclasscmds.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 8e67219cc0..343f5a70cf 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.45 2006/05/02 22:25:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.46 2006/06/16 20:23:44 adunstan Exp $
*
*-------------------------------------------------------------------------
*/
@@ -700,21 +700,40 @@ RemoveOpClass(RemoveOpClassStmt *stmt)
/* Unqualified opclass name, so search the search path */
opcID = OpclassnameGetOpcid(amID, opcname);
if (!OidIsValid(opcID))
- ereport(ERROR,
- (errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("operator class \"%s\" does not exist for access method \"%s\"",
- opcname, stmt->amname)));
+ {
+ if (! stmt -> missing_ok )
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("operator class \"%s\" does not exist for access method \"%s\"",
+ opcname, stmt->amname)));
+ else
+ ereport(NOTICE,
+ (errmsg("operator class \"%s\" does not exist for access method \"%s\"",
+ opcname, stmt->amname)));
+
+ return;
+ }
+
tuple = SearchSysCache(CLAOID,
ObjectIdGetDatum(opcID),
0, 0, 0);
}
if (!HeapTupleIsValid(tuple))
- ereport(ERROR,
- (errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("operator class \"%s\" does not exist for access method \"%s\"",
- NameListToString(stmt->opclassname), stmt->amname)));
-
+ {
+
+ if (! stmt->missing_ok )
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("operator class \"%s\" does not exist for access method \"%s\"",
+ NameListToString(stmt->opclassname), stmt->amname)));
+ else
+ ereport(NOTICE,
+ (errmsg("operator class \"%s\" does not exist for access method \"%s\"",
+ NameListToString(stmt->opclassname), stmt->amname)));
+ return;
+ }
+
opcID = HeapTupleGetOid(tuple);
/* Permission check: must own opclass or its namespace */