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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Ash M <makmarath(at)hotmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
Date: 2019-02-20 05:56:27
Message-ID: 20190220055627.GH15532@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

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().

- 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().
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2019-02-20 08:34:15 Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
Previous Message Michael Paquier 2019-02-20 03:50:11 Re: BUG #15638: pg_basebackup with --wal-method=stream incorrectly generates WAL segment created during backup

Browse pgsql-hackers by date

  From Date Subject
Next Message Jamison, Kirk 2019-02-20 06:04:52 RE: Timeout parameters
Previous Message Amit Langote 2019-02-20 05:47:15 Re: speeding up planning with partitions