Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-17 Thread Robert Haas
On Fri, Jun 13, 2014 at 11:57 AM, David Johnston wrote: >> That's not the reading I want, and it's not the reading you want either, >> but there is nothing in the existing text that justifies single >> evaluation. So I think we'd be well advised to sit on our hands until >> the committee clarifie

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread David Johnston
On Fri, Jun 13, 2014 at 11:32 AM, Tom Lane wrote: > David G Johnston writes: > > Tom Lane-2 wrote > >> At the very least I think we should stay away from this syntax until > >> the SQL committee understand it better than they evidently do today. > >> I don't want to implement it and then get cau

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
2014-06-13 17:32 GMT+02:00 Tom Lane : > David G Johnston writes: > > Tom Lane-2 wrote > >> At the very least I think we should stay away from this syntax until > >> the SQL committee understand it better than they evidently do today. > >> I don't want to implement it and then get caught by a futu

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Alvaro Herrera
Quan Zongliang wrote: > Hi all, > > Please find the attachment. > > By my friend asking, for convenience, > support to define multi variables in single PL/pgSQL line. > > Like this: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, local_b, local_c text :=

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Tom Lane
David G Johnston writes: > Tom Lane-2 wrote >> At the very least I think we should stay away from this syntax until >> the SQL committee understand it better than they evidently do today. >> I don't want to implement it and then get caught by a future >> clarification that resolves the issue diffe

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread David G Johnston
Tom Lane-2 wrote > Andres Freund < > andres@ > > writes: >> On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: >>> Quan' example is 100% valid in SQL/PSM and what I read about ADA then in >>> ADA too. > >> So what? plpgsql is neither language and this doesn't seem to be the way >> to make them a

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Tom Lane
Andres Freund writes: > On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: >> Quan' example is 100% valid in SQL/PSM and what I read about ADA then in >> ADA too. > So what? plpgsql is neither language and this doesn't seem to be the way > to make them actually closer (which I doubt would be a go

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
2014-06-13 16:17 GMT+02:00 Andres Freund : > On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: > > Quan' example is 100% valid in SQL/PSM and what I read about ADA then in > > ADA too. > > So what? plpgsql is neither language and this doesn't seem to be the way > to make them actually closer (whi

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Andres Freund
On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: > Quan' example is 100% valid in SQL/PSM and what I read about ADA then in > ADA too. So what? plpgsql is neither language and this doesn't seem to be the way to make them actually closer (which I doubt would be a good idea in the first place). G

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
We can disallow custom initialization when when variables are declared as list. Quan' example is 100% valid in SQL/PSM and what I read about ADA then in ADA too. Regards Pavel 2014-06-13 16:04 GMT+02:00 Tom Lane : > Quan Zongliang writes: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETU

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Tom Lane
Quan Zongliang writes: > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, local_b, local_c text := 'a1'; > BEGIN > return local_a || local_b || local_c; > end; > $$ LANGUAGE plpgsql; This does not seem like a terribly good idea from here. The main problem

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 4:43 PM, Pavel Stehule wrote: > > > > 2014-06-13 9:41 GMT+02:00 Michael Paquier : > >> On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang >> wrote: >> > By my friend asking, for convenience, >> > support to define multi variables in single PL/pgSQL line. >> > >> > Like this:

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Quan Zongliang
On 06/13/2014 03:42 PM, Ian Barwick wrote: Hi On 14/06/13 16:20, Quan Zongliang wrote: Hi all, Please find the attachment. By my friend asking, for convenience, support to define multi variables in single PL/pgSQL line. Like this: CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
2014-06-13 9:41 GMT+02:00 Michael Paquier : > On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang > wrote: > > By my friend asking, for convenience, > > support to define multi variables in single PL/pgSQL line. > > > > Like this: > > > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Ian Barwick
Hi On 14/06/13 16:20, Quan Zongliang wrote: > Hi all, > > Please find the attachment. > > By my friend asking, for convenience, > support to define multi variables in single PL/pgSQL line. > > Like this: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, l

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang wrote: > By my friend asking, for convenience, > support to define multi variables in single PL/pgSQL line. > > Like this: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, local_b, local_c text := 'a1'; > B

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
Hello + it is natural in almost all languages including ADA - it increases a distance between PL/pgSQL and PL/SQL I am don't think, so this feature is necessary, but I am not against it. Regards Pavel 2014-06-13 9:20 GMT+02:00 Quan Zongliang : > Hi all, > > Please find the attachment. > >

[HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Quan Zongliang
Hi all, Please find the attachment. By my friend asking, for convenience, support to define multi variables in single PL/pgSQL line. Like this: CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ DECLARE local_a, local_b, local_c text := 'a1'; BEGIN return local_a || local_b ||