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

From David Rowley
Subject Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name
Date
Msg-id CAKJS1f-ABpt_oT1dL6rSvBch7-u-9+qBLb1KGrhTvDiHZ37e2Q@mail.gmail.com
Whole thread Raw
In response to Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name  (Michael Paquier <michael@paquier.xyz>)
Responses Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, 20 Feb 2019 at 18:56, Michael Paquier <michael@paquier.xyz> wrote:
>
> On Wed, Feb 20, 2019 at 09:57:19AM +1300, David Rowley wrote:
> > Great. Thanks for reviewing it.
>
> You forgot to change a call of LookupFuncWithArgs() in
> CreateTransform().

Yikes, Arthur did mention that, but I somehow managed to stumble over
it when I checked. The attached fixes.

> -    address.objectId = LookupFuncWithArgs(objtype, castNode(ObjectWithArgs, object), missing_ok);
> +    address.objectId = LookupFuncWithArgs(objtype, castNode(ObjectWithArgs, object),
> +                                          missing_ok ? FUNCLOOKUP_ERRIFAMBIGUOUS :
> +                                          FUNCLOOKUP_NORMAL);
>
> LookupFuncWithArgs() calls itself LookupFuncName(), which may not use
> the check type provided by the caller..  I think that the existing API
> is already confusing enough, and this patch makes it a bit more
> confusing by adding an extra error layer handling on top of it.
> Wouldn't it be more simple from an error handling point of view to
> move all the error handling into LookupFuncName() and let the caller
> decide what kind of function type handling it expects from the start?
> I think that the right call is to add the object type into the
> arguments of LookupFuncName().

But there are plenty of callers that use LookupFuncName() directly. Do
you happen to know it's okay for all those to error out with the
additional error conditions that such a change would move into that
function?  I certainly don't know that.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #15572: Misleading message reported by "Drop functionoperation" on DB with functions having same name
Next
From: PG Bug reporting form
Date:
Subject: BUG #15644: not able to up the database