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

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: makmarath(at)hotmail(dot)com, 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-01-07 14:54:03
Message-ID: 201901071454.wxkoyoq4s5qp@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 2019-Jan-04, David Rowley wrote:

> It's not really that clear to me that doing that would be any more
> correct than the alternative.

I think it would be. Specifying a function without params works only if
it's unambiguous; if ambiguity is possible, raise an error. On the
other hand, lack of IF EXISTS is supposed to raise an error if the
function doesn't exist; its presence means not the report that
particular error, but it doesn't mean to suppress other errors such as
the ambiguity one.

I'm not sure what's a good way to implement this, however. Maybe the
solution is to have LookupFuncName return InvalidOid when the function
name is ambiguous and let LookupFuncWithArgs report the error
appropriately. I think this behavior is weird:

/*
* When looking for a function or routine, we pass noError through to
* LookupFuncName and let it make any error messages. Otherwise, we make
* our own errors for the aggregate and procedure cases.
*/
oid = LookupFuncName(func->objname, func->args_unspecified ? -1 : argcount, argoids,
(objtype == OBJECT_FUNCTION || objtype == OBJECT_ROUTINE) ? noError : true);

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-01-07 14:57:59 Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
Previous Message a Marath 2019-01-07 14:18:49 Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-07 15:37:28 Re: Use atexit() in initdb and pg_basebackup
Previous Message Masahiko Sawada 2019-01-07 14:36:58 Re: Using logical replication with older version subscribers