Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9802619

Browse files
committed
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 fd1843f; so backpatch to 9.1.X. Report and diagnosis by KaiGai Kohei.
1 parent b4a0223 commit 9802619

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/backend/commands/opclasscmds.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -1613,10 +1613,9 @@ RemoveOpFamily(RemoveOpFamilyStmt *stmt)
16131613
tuple = OpFamilyCacheLookup(amID, stmt->opfamilyname, stmt->missing_ok);
16141614
if (!HeapTupleIsValid(tuple))
16151615
{
1616-
ereport(ERROR,
1617-
(errcode(ERRCODE_UNDEFINED_OBJECT),
1618-
errmsg("operator family \"%s\" does not exist for access method \"%s\"",
1619-
NameListToString(stmt->opfamilyname), stmt->amname)));
1616+
ereport(NOTICE,
1617+
(errmsg("operator family \"%s\" does not exist for access method \"%s\", skipping",
1618+
NameListToString(stmt->opfamilyname), stmt->amname)));
16201619
return;
16211620
}
16221621

src/test/regress/expected/drop_if_exists.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ ERROR: access method "no_such_am" does not exist
214214
DROP OPERATOR FAMILY test_operator_family USING btree;
215215
ERROR: operator family "test_operator_family" does not exist for access method "btree"
216216
DROP OPERATOR FAMILY IF EXISTS test_operator_family USING btree;
217-
ERROR: operator family "test_operator_family" does not exist for access method "btree"
217+
NOTICE: operator family "test_operator_family" does not exist for access method "btree", skipping
218218
DROP OPERATOR FAMILY test_operator_family USING no_such_am;
219219
ERROR: access method "no_such_am" does not exist
220220
DROP OPERATOR FAMILY IF EXISTS test_operator_family USING no_such_am;

0 commit comments

Comments
 (0)