pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Abelardo León González <everis@abelardolg.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Stored function | Grayed out option when I try modify the return type
Date: Thu, 12 Jul 2018 05:29:23 -0700
Message-ID: <073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com> (raw)
In-Reply-To: <001c01d419c2$b7e27b10$27a77130$@abelardolg.com>
References: <007b01d419b9$ebffc8c0$c3ff5a40$@abelardolg.com>
	<b3060f89-69da-5815-6fe7-d4e771a5f69b@a-kretschmer.de>
	<013a01d419be$32c61530$98523f90$@abelardolg.com>
	<f6452277-d978-af6a-fa48-553a78558663@a-kretschmer.de>
	<001c01d419c2$b7e27b10$27a77130$@abelardolg.com>

On 07/12/2018 02:28 AM, Abelardo León González wrote:
> 
> 
> -----Mensaje original-----
> De: Andreas Kretschmer <andreas@a-kretschmer.de>
> Enviado el: jueves, 12 de julio de 2018 11:07
> Para: Abelardo León González <everis@abelardolg.com>; 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




view thread (7+ messages)

Message-ID: <073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com>
Permalink:  ../073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com/
Also on:    postgresql.org/message-id/073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, everis@abelardolg.com
  Subject: Re: Stored function | Grayed out option when I try modify the return type
  In-Reply-To: <073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com>
  References: <007b01d419b9$ebffc8c0$c3ff5a40$@abelardolg.com> <b3060f89-69da-5815-6fe7-d4e771a5f69b@a-kretschmer.de> <013a01d419be$32c61530$98523f90$@abelardolg.com> <f6452277-d978-af6a-fa48-553a78558663@a-kretschmer.de> <001c01d419c2$b7e27b10$27a77130$@abelardolg.com> <073c767a-a672-40e2-61da-81980f4fdc44@aklaver.com>

* 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