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

From: Arthur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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-14 13:42:35
Message-ID: 2a286c8f-070e-f0e3-8463-0da163ad5c8a@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hello,

On 11.02.2019 05:36, David Rowley wrote:
> On Mon, 11 Feb 2019 at 11:39, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message jfinzel 2019-02-14 20:33:43 Re: Segmentation Fault in logical decoding get/peek API
Previous Message Pavlo Golub 2019-02-14 08:26:38 Re: BUG #15626: Incorrect version number shown in BigSQL installation

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Banck 2019-02-14 14:07:56 [Patch] checksumming-related buglets in pg_verify_checksums/pg_basebackup TAP tests
Previous Message Sergei Kornilov 2019-02-14 13:31:22 Re: pg11.1: dsa_area could not attach to segment