]> granicus.if.org Git - postgresql/commit
Improve error reporting for DROP FUNCTION/PROCEDURE/AGGREGATE/ROUTINE.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 21 Mar 2019 15:51:55 +0000 (11:51 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 21 Mar 2019 15:52:08 +0000 (11:52 -0400)
commitbfb456c1b9656d5b717b84d833f62cf712b21726
tree67eb2d06b65a7b962e20eac5a545448cc8c43382
parent0f086f84ad9041888b789af5871c7432f0e19c5b
Improve error reporting for DROP FUNCTION/PROCEDURE/AGGREGATE/ROUTINE.

These commands allow the argument type list to be omitted if there is
just one object that matches by name.  However, if that syntax was
used with DROP IF EXISTS and there was more than one match, you got
a "function ... does not exist, skipping" notice message rather than a
truthful complaint about the ambiguity.  This was basically due to
poor factorization and a rats-nest of logic, so refactor the relevant
lookup code to make it cleaner.

Note that this amounts to narrowing the scope of which sorts of
error conditions IF EXISTS will bypass.  Per discussion, we only
intend it to skip no-such-object cases, not multiple-possible-matches
cases.

Per bug #15572 from Ash Marath.  Although this definitely seems like
a bug, it's not clear that people would thank us for changing the
behavior in minor releases, so no back-patch.

David Rowley, reviewed by Julien Rouhaud and Pavel Stehule

Discussion: https://postgr.es/m/15572-ed1b9ed09503de8a@postgresql.org
src/backend/parser/parse_func.c
src/include/parser/parse_func.h
src/test/regress/expected/drop_if_exists.out
src/test/regress/sql/drop_if_exists.sql