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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: "makmarath(at)hotmail(dot)com" <makmarath(at)hotmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
Date: 2019-01-04 06:10:05
Message-ID: CAKFQuwaOZaFTunM84ZOYC5VHH0yMB_VF=3Pa1V55AtteTPjijg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Thursday, January 3, 2019, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
wrote:

> If we changed the behaviour of this then
> someone might equally come along later and complain that they
> specified "IF EXISTS" and got an error.
>

I’m inclined to argue that the docs say you can only use the omitted-args
name if it is unique within the schema. Since the second case is using
that form in violation of that requirement reporting an error would match
the documentation.

IF EXISTS only applies when no functions exist; an error for ambiguity
doesn’t violate its promise; and likely even if we didn’t make it an error
something else will fail later on.

It is wrong for the drop function if exists command to translate/print the
omitted-args form of the name into a function with zero arguments; it
should not be looking explicitly for a zero-arg function as it is not the
same thing (as emphasized in the docs).

So, I vote for changing this in 12 but leaving prior versions as-is for
compatability as the harm doesn’t seem to be enough to risk breakage.
Might be worth a doc patch showing the second case for the back branches
(Head seems like it would be good as we are fixing the code to match the
documentation, IMO).

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2019-01-04 10:32:31 Re: BUG #15548: Unaccent does not remove combining diacritical characters
Previous Message David Rowley 2019-01-04 04:45:16 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 Surafel Temesgen 2019-01-04 06:40:32 Re: FETCH FIRST clause PERCENT option
Previous Message Andrew Alsup 2019-01-04 05:13:37 Re: SQL/JSON: functions