pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: makmarath@hotmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
Date: Mon, 7 Jan 2019 11:54:03 -0300
Message-ID: <201901071454.wxkoyoq4s5qp@alvherre.pgsql> (raw)
In-Reply-To: <CAKJS1f9nQyOcCdjJ0HP=DCRanDLOCp7+L2QCnR2BAXM-8Zh5vw@mail.gmail.com>

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




view thread (38+ messages)  latest in thread

Message-ID: <201901071454.wxkoyoq4s5qp@alvherre.pgsql>
Permalink:  ../201901071454.wxkoyoq4s5qp@alvherre.pgsql/
Also on:    postgresql.org/message-id/201901071454.wxkoyoq4s5qp@alvherre.pgsql

 · 

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: alvherre@2ndquadrant.com, david.rowley@2ndquadrant.com, makmarath@hotmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name
  In-Reply-To: <201901071454.wxkoyoq4s5qp@alvherre.pgsql>

* 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