BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name

The Post Office <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: makmarath@hotmail.com
Date: 2019-01-03T20:27:33Z
Lists: pgsql-bugs, pgsql-hackers
The following bug has been logged on the website:

Bug reference:      15572
Logged by:          Ash Marath
Email address:      makmarath@hotmail.com
PostgreSQL version: 10.5
Operating system:   RDS (on Amazon)
Description:        

Scenario:
DB has 2 functions with same name.
DB: testDB
Schema: test
Function 1: test.func1(param1 text, param2 text)
Function 2: test.func1(param1 text)
---------------------------------
Issue: Misleading message reported by "DROP FUNCTION" command with the above
scenario 

Step 1: 
Run the command : DROP FUNCTION test.func1;

NOTE: This operation failed to execute the drop and reported the following
message

Message reported by PgAdmin4 & OmniDB:
 ---- start of message ------
         function name "test.func1" is not unique
         HINT:  Specify the argument list to select the function
unambiguously.
 ---- end of message ------
--------------------------------------------------------------------------------------------------------
Step 2: 
Run the command : DROP FUNCTION IF EXISTS test.func1;

NOTE: This operation completed successfully without error and reported the
following message

Message reported by PgAdmin4 & OmniDB:
 ---- start of message ------
          function admq.test1() does not exist, skipping
 ---- end of message ------
-----------------------------------------------------------------------------------------------------------
Proposed solution:
The operation in Step 2 should have failed with the same error as reported
in Step 1;

Thanks
Ash Marath
makmarath@hotmail.com

Commits

  1. Improve error reporting for DROP FUNCTION/PROCEDURE/AGGREGATE/ROUTINE.