pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Stored function | Grayed out option when I try modify the return type
7+ messages / 3 participants
[nested] [flat]

* Stored function | Grayed out option when I try modify the return type
@ 2018-07-12 08:25 Abelardo León González <everis@abelardolg.com>
  2018-07-12 08:52 ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  0 siblings, 1 reply; 7+ messages in thread

From: Abelardo León González @ 2018-07-12 08:25 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello world,

 

Here a newbie in PgAdmin.

 

When I create a stored function and I try to modify it to change the return
type (or anything else), I can’t modify it.

 

I am not sure if it is a bug….and I am not sure if this message should be in
bugs mail list. Sorry if I am wrong.

 

Best regards,

 

Abelardo.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Stored function | Grayed out option when I try modify the return type
  2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
@ 2018-07-12 08:52 ` Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 08:56   ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Andreas Kretschmer @ 2018-07-12 08:52 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org



Am 12.07.2018 um 10:25 schrieb Abelardo León González:
>
> Hello world,
>
> Here a newbie in PgAdmin.
>
> When I create a stored function and I try to modify it to change the 
> return type (or anything else), I can’t modify it.
>
> I am not sure if it is a bug….and I am not sure if this message should 
> be in bugs mail list. Sorry if I am wrong.
>

it's not a bug. If you want to change the return-type or 
input-parameters you have to recreate (drop the current one and create a 
new) the function - or to create a new (additional) one.


Regards, Andreas

-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* RE: Stored function | Grayed out option when I try modify the return type
  2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 08:52 ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
@ 2018-07-12 08:56   ` Abelardo León González <everis@abelardolg.com>
  2018-07-12 09:07     ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  0 siblings, 1 reply; 7+ messages in thread

From: Abelardo León González @ 2018-07-12 08:56 UTC (permalink / raw)
  To: 'Andreas Kretschmer' <andreas@a-kretschmer.de>; pgsql-general@lists.postgresql.org

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!

:/



Best regards. 

-----Mensaje original-----
De: Andreas Kretschmer <andreas@a-kretschmer.de> 
Enviado el: jueves, 12 de julio de 2018 10:53
Para: 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:25 schrieb Abelardo León González:
>
> Hello world,
>
> Here a newbie in PgAdmin.
>
> When I create a stored function and I try to modify it to change the 
> return type (or anything else), I can’t modify it.
>
> I am not sure if it is a bug….and I am not sure if this message should 
> be in bugs mail list. Sorry if I am wrong.
>

it's not a bug. If you want to change the return-type or input-parameters
you have to recreate (drop the current one and create a
new) the function - or to create a new (additional) one.


Regards, Andreas

--
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com







^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Stored function | Grayed out option when I try modify the return type
  2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 08:52 ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 08:56   ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
@ 2018-07-12 09:07     ` Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 09:28       ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Andreas Kretschmer @ 2018-07-12 09:07 UTC (permalink / raw)
  To: Abelardo León González <everis@abelardolg.com>; pgsql-general@lists.postgresql.org



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





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* RE: Stored function | Grayed out option when I try modify the return type
  2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 08:52 ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 08:56   ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 09:07     ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
@ 2018-07-12 09:28       ` Abelardo León González <everis@abelardolg.com>
  2018-07-12 10:15         ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 12:29         ` Re: Stored function | Grayed out option when I try modify the return type Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 2 replies; 7+ messages in thread

From: Abelardo León González @ 2018-07-12 09:28 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org



-----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. 

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.





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Stored function | Grayed out option when I try modify the return type
  2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 08:52 ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 08:56   ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 09:07     ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 09:28       ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
@ 2018-07-12 10:15         ` Andreas Kretschmer <andreas@a-kretschmer.de>
  1 sibling, 0 replies; 7+ messages in thread

From: Andreas Kretschmer @ 2018-07-12 10:15 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org



Am 12.07.2018 um 11:28 schrieb Abelardo León González:
> 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.

yeah, i understand.


> 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.

it's not a limitation of PGAdmin.

> 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.

You can pull out the whole function definition, for instance within psql 
with \ef <function_name>, safe this into a file, drop the function, edit 
the file and create the new function.
Seems a bit of strange, but that's the usual way.
>
> Sorry for my English (I am non English native).

the same for me ;-)


Regards, Andreas

-- 
2ndQuadrant - The PostgreSQL Support Company.
www.2ndQuadrant.com





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Stored function | Grayed out option when I try modify the return type
  2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 08:52 ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 08:56   ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
  2018-07-12 09:07     ` Re: Stored function | Grayed out option when I try modify the return type Andreas Kretschmer <andreas@a-kretschmer.de>
  2018-07-12 09:28       ` RE: Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
@ 2018-07-12 12:29         ` Adrian Klaver <adrian.klaver@aklaver.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Adrian Klaver @ 2018-07-12 12:29 UTC (permalink / raw)
  To: Abelardo León González <everis@abelardolg.com>; pgsql-general@lists.postgresql.org

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




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2018-07-12 12:29 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-12 08:25 Stored function | Grayed out option when I try modify the return type Abelardo León González <everis@abelardolg.com>
2018-07-12 08:52 ` Andreas Kretschmer <andreas@a-kretschmer.de>
2018-07-12 08:56   ` Abelardo León González <everis@abelardolg.com>
2018-07-12 09:07     ` Andreas Kretschmer <andreas@a-kretschmer.de>
2018-07-12 09:28       ` Abelardo León González <everis@abelardolg.com>
2018-07-12 10:15         ` Andreas Kretschmer <andreas@a-kretschmer.de>
2018-07-12 12:29         ` Adrian Klaver <adrian.klaver@aklaver.com>

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