Commit 98026192 authored by Robert Haas's avatar Robert Haas

Fix DROP OPERATOR FAMILY IF EXISTS.

Essentially, the "IF EXISTS" portion was being ignored, and an error
thrown anyway if the opfamily did not exist.

I broke this in commit fd1843ff; so
backpatch to 9.1.X.

Report and diagnosis by KaiGai Kohei.
parent b4a0223d
...@@ -1613,10 +1613,9 @@ RemoveOpFamily(RemoveOpFamilyStmt *stmt) ...@@ -1613,10 +1613,9 @@ RemoveOpFamily(RemoveOpFamilyStmt *stmt)
tuple = OpFamilyCacheLookup(amID, stmt->opfamilyname, stmt->missing_ok); tuple = OpFamilyCacheLookup(amID, stmt->opfamilyname, stmt->missing_ok);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
{ {
ereport(ERROR, ereport(NOTICE,
(errcode(ERRCODE_UNDEFINED_OBJECT), (errmsg("operator family \"%s\" does not exist for access method \"%s\", skipping",
errmsg("operator family \"%s\" does not exist for access method \"%s\"", NameListToString(stmt->opfamilyname), stmt->amname)));
NameListToString(stmt->opfamilyname), stmt->amname)));
return; return;
} }
......
...@@ -214,7 +214,7 @@ ERROR: access method "no_such_am" does not exist ...@@ -214,7 +214,7 @@ ERROR: access method "no_such_am" does not exist
DROP OPERATOR FAMILY test_operator_family USING btree; DROP OPERATOR FAMILY test_operator_family USING btree;
ERROR: operator family "test_operator_family" does not exist for access method "btree" ERROR: operator family "test_operator_family" does not exist for access method "btree"
DROP OPERATOR FAMILY IF EXISTS test_operator_family USING btree; DROP OPERATOR FAMILY IF EXISTS test_operator_family USING btree;
ERROR: operator family "test_operator_family" does not exist for access method "btree" NOTICE: operator family "test_operator_family" does not exist for access method "btree", skipping
DROP OPERATOR FAMILY test_operator_family USING no_such_am; DROP OPERATOR FAMILY test_operator_family USING no_such_am;
ERROR: access method "no_such_am" does not exist ERROR: access method "no_such_am" does not exist
DROP OPERATOR FAMILY IF EXISTS test_operator_family USING no_such_am; DROP OPERATOR FAMILY IF EXISTS test_operator_family USING no_such_am;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment