Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guHHq-0005ua-0u for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Feb 2019 13:42:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guHHo-0003oG-6Z for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Feb 2019 13:42:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guHHn-0003lT-P3 for pgsql-bugs@lists.postgresql.org; Thu, 14 Feb 2019 13:42:44 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guHHj-0007No-H3 for pgsql-bugs@lists.postgresql.org; Thu, 14 Feb 2019 13:42:42 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 591FF21CBF2B; Thu, 14 Feb 2019 16:42:36 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.237] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id A6DA221CBEAB; Thu, 14 Feb 2019 16:42:35 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1550151755; bh=1BIrNTLCE8PwAjAGm8+igPWVhVja2ZGoI/o0v8RsS8Q=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=jvxSjGOJKgqJGVzfjELFXps24VEuaD7tCITO9wsC28AmNcPjO7LaKny4R0PVoVnnI D4Hu8xDtf5v7pP3ce1ij4QYYWqdTAIRhZfdE+L+FhGlnmxK93TnU9Bcf/jtNU4CsaV HGgovYX1pZbOTPPEmwO6T+RgMgflpZ+HgyMmd1S0= Subject: Re: BUG #15572: Misleading message reported by "Drop function operation" on DB with functions having same name To: David Rowley , Tom Lane Cc: Alvaro Herrera , Ash M , PostgreSQL mailing lists References: <201901071454.wxkoyoq4s5qp@alvherre.pgsql> <19400.1546994166@sss.pgh.pa.us> <13325.1549838359@sss.pgh.pa.us> From: Arthur Zakirov Message-ID: <2a286c8f-070e-f0e3-8463-0da163ad5c8a@postgrespro.ru> Date: Thu, 14 Feb 2019 16:42:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello, On 11.02.2019 05:36, David Rowley wrote: > On Mon, 11 Feb 2019 at 11:39, Tom Lane 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