pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
Date: Thu, 21 Mar 2019 12:04:34 -0400
Message-ID: <21616.1553184274@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKJS1f9bfqQGESNC9QMLPs72pvTNkN595a5gAs4M1=Pj_Wb5YQ@mail.gmail.com>
References: <15572-ed1b9ed09503de8a@postgresql.org>
	<CAKJS1f8J5jKd9J60qK15H-sU93Fmz2X1U2QfY-a5mD6XgaqKVA@mail.gmail.com>
	<155300941700.16480.7948036003189357692.pgcf@coridan.postgresql.org>
	<CAKJS1f9bfqQGESNC9QMLPs72pvTNkN595a5gAs4M1=Pj_Wb5YQ@mail.gmail.com>

David Rowley <david.rowley@2ndquadrant.com> writes:
> [ drop_func_if_not_exists_fix_v9.patch ]

Pushed with mostly-cosmetic adjustments.

I noticed a couple of loose ends that are somewhat outside the scope
of the bug report, but maybe are worth considering now:

1. There's some inconsistency in the wording of the error messages in
these routines, eg

             errmsg("%s is not a function",
vs
             errmsg("%s is not a procedure",
vs
             errmsg("function %s is not an aggregate",

Also there's
             errmsg("function name \"%s\" is not unique",
where elsewhere in parse_func.c, we find
             errmsg("function %s is not unique",

You didn't touch this and I didn't either, but maybe we should try to
make these consistent?

2. Consider

regression=# CREATE FUNCTION ambig(int) returns int as $$ select $1; $$ language sql;
CREATE FUNCTION
regression=# CREATE PROCEDURE ambig() as $$ begin end; $$ language plpgsql;
CREATE PROCEDURE
regression=# DROP PROCEDURE ambig;
ERROR:  procedure name "ambig" is not unique
HINT:  Specify the argument list to select the procedure unambiguously.

Arguably, because I said "drop procedure", there's no ambiguity here;
but we don't account for objtype while doing the lookup.

I'm inclined to leave point 2 alone, because we haven't had complaints
about it, and because I'm not sure we could make it behave in a clean
way given the historical ambiguity about what OBJECT_FUNCTION should
match.  But perhaps it's worth discussing.

			regards, tom lane




view thread (38+ messages)  latest in thread

Message-ID: <21616.1553184274@sss.pgh.pa.us>
Permalink:  ../21616.1553184274@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21616.1553184274@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, david.rowley@2ndquadrant.com, pavel.stehule@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
  In-Reply-To: <21616.1553184274@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox