Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name - Mailing list pgsql-bugs

From Arthur Zakirov
Subject Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name
Date
Msg-id 2a286c8f-070e-f0e3-8463-0da163ad5c8a@postgrespro.ru
Whole thread Raw
In response to Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name
List pgsql-bugs
Hello,

On 11.02.2019 05:36, David Rowley wrote:
> On Mon, 11 Feb 2019 at 11:39, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I wonder whether you'd be better off replacing the two bools with an
>> enum, or something like that.
> 
> Okay. Here's a modified patch with the enum.

There is a LookupFuncWithArgs() call within CreateTransform() where 
`bool` is passed still:

tosqlfuncid = LookupFuncWithArgs(OBJECT_FUNCTION, stmt->tosql, *false*);

> I had a look and I can't see any other callers that pass nargs as -1
> and can pass noError as true. The only place I see is through
> get_object_address() in RemoveObjects(). There's another possible call
> in get_object_address_rv(), but there's only 1 call in the entire
> source for that function and it passes missing_ok as false.

If nargs as -1 and noError as true can be passed only within 
RemoveObjects() I wonder, could we just end up with a patch which raise 
an error at every ambiguity? That is I mean the following patch:

diff --git a/src/backend/parser/parse_func.c 
b/src/backend/parser/parse_func.c
index 5222231b51..cce8f49f52 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -2053,7 +2053,6 @@ LookupFuncName(List *funcname, int nargs, const 
Oid *argtypes, bool noError)
         {
             if (clist->next)
             {
-               if (!noError)
                     ereport(ERROR,
                             (errcode(ERRCODE_AMBIGUOUS_FUNCTION),
                              errmsg("function name \"%s\" is not unique",

But I may overlook something of course.

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company


pgsql-bugs by date:

Previous
From: Pavlo Golub
Date:
Subject: Re: BUG #15626: Incorrect version number shown in BigSQL installation
Next
From: jfinzel
Date:
Subject: Re: Segmentation Fault in logical decoding get/peek API