Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdaiy-0002pE-RH for pgsql-general@arkaria.postgresql.org; Thu, 12 Jul 2018 12:29:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fdaix-0007yb-6y for pgsql-general@arkaria.postgresql.org; Thu, 12 Jul 2018 12:29:31 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdaiv-0007y6-KB for pgsql-general@lists.postgresql.org; Thu, 12 Jul 2018 12:29:31 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdair-000083-VE for pgsql-general@lists.postgresql.org; Thu, 12 Jul 2018 12:29:28 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id DF21121B64; Thu, 12 Jul 2018 08:29:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 12 Jul 2018 08:29:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=W4IJzlCfLkRqZhW0+XCoM5IykEh+K CmNsmpBAWtu+eA=; b=VMpIxUUOL6Cvg2LfB1IOh8xGCe4k8ed+WeeOtakk6Suuh Lb7RjD1HE1xHhVYBgjz4PEkt3Qo26TMmEL3FTvQbdBGEzQgv4jzZNdDvfc9SHfQ0 r1VfmVeIrcdcfH/aUIkLSATNva4ZJpTpDLt1ap4AOyD9K+3j5+OXjgnHhBN+mzu+ cs9Jjc7HE52XpE8OnUrlesUb4cgfBnmZh7JQjSK4NaznP/8WKRwrX3wYKNF3wDv+ w69iqpSZ2njUtlY8Yjyudwik01d0QTl6ciEgqcaM5lhIDgLKahMhUUxisufeZbwX GA57rdY7BwdXF4+9ueBXpF8mhBPvgZ38VMn50ygVw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=W4IJzl CfLkRqZhW0+XCoM5IykEh+KCmNsmpBAWtu+eA=; b=H5Wf4UYLlsbeaGhnoXlmPZ TEVGnHlwDv3vWnwS++sWsbWDTIJTt3Gh1Tkuq0K1PVMz/MSAzJ8uCMHrWX5oAabR ID9m5RiSn6HQPTYiaCo/UlHQHIBLTf+arsstmDK0NBZYnRRgLbazc2Wlp9nrSd0F nOHaT3Omed+ooinAMe8TEA81KmrNsdWPjJhWK40YY3sNH2/VOccalf6J+q8N8/lE i0FwCdTH3qANGfm0lC1gjLPA7qDwnMnZjvh6vxSnfwdJR8yWlZ9RHTVhcIRrg4rq MHZ+iMVbMKaaggwyI/uLPheA4pCMm/wVBzjc8baYdZpib5rZeHZ8ADnyLkCUOoyg == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.181]) by mail.messagingengine.com (Postfix) with ESMTPA id 42DF0E4447; Thu, 12 Jul 2018 08:29:24 -0400 (EDT) Subject: Re: Stored function | Grayed out option when I try modify the return type To: =?UTF-8?Q?Abelardo_Le=c3=b3n_Gonz=c3=a1lez?= , pgsql-general@lists.postgresql.org References: <007b01d419b9$ebffc8c0$c3ff5a40$@abelardolg.com> <013a01d419be$32c61530$98523f90$@abelardolg.com> <001c01d419c2$b7e27b10$27a77130$@abelardolg.com> From: Adrian Klaver Message-ID: <073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com> Date: Thu, 12 Jul 2018 05:29:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <001c01d419c2$b7e27b10$27a77130$@abelardolg.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/12/2018 02:28 AM, Abelardo León González wrote: > > > -----Mensaje original----- > De: Andreas Kretschmer > Enviado el: jueves, 12 de julio de 2018 11:07 > Para: Abelardo León González ; pgsql-general@lists.postgresql.org > Asunto: Re: Stored function | Grayed out option when I try modify the return type > > > > Am 12.07.2018 um 10:56 schrieb Abelardo León González: >> Thanks Andreas for your response. >> >> This is an annoying procedure to modify it. >> Why did pgAdmin staff decide to do it this way? It's a waste time! > No. Two functions with the same name, but different returns types (for > instance) are valid and 2 different functions. > You can define a function and change the body of the function, that's not a problem, but with different returns you will have 2 different functions. > > Please don't top-posting here, thx. > > > Regards, Andreas > > -- > 2ndQuadrant - The PostgreSQL Support Company. > www.2ndQuadrant.com > > Sorry for top-posting here. :S I won't do it anymore. > > The idea is to modify the original function in order to meet the requirements. > It's not to create two functions, it's to modify the original one. > Internally, pgAdmin should invoke to the "alter function" command so that this modification doesn't create another function. No such option: https://www.postgresql.org/docs/10/static/sql-alterfunction.html There is CREATE OR REPLACE FUNCTION: https://www.postgresql.org/docs/10/static/sql-createfunction.html But as pointed out you cannot change the return type that way: "... Also, CREATE OR REPLACE FUNCTION will not let you change the return type of an existing function. To do that, you must drop and recreate the function. (When using OUT parameters, that means you cannot change the types of any OUT parameters except by dropping the function.) " Remember pgAdmin is just a GUI over Postgres commands. It often helps to run a command in psql to verify whether it is valid or not. > > If I have created funcA with return type smallint but I would like to modify to integer, pgAdmin shouldn't create another one but let us directly modify the original funcA's return type. > > Sorry for my English (I am non English native). I don't know if I have explained my issue and my complaint correctly. > > Best regards. > > > -- Adrian Klaver adrian.klaver@aklaver.com