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 david.g.johns...@gmail.com 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

[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

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 quanzongli...@gmail.com: Hi all, Please find

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 quanzongli...@gmail.com 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

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, local_b,

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 michael.paqu...@gmail.com: On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang quanzongli...@gmail.com wrote: By my friend asking, for convenience, support to define multi variables in single PL/pgSQL line. Like this: CREATE OR REPLACE FUNCTION

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

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 pavel.steh...@gmail.com wrote: 2014-06-13 9:41 GMT+02:00 Michael Paquier michael.paqu...@gmail.com: On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang quanzongli...@gmail.com wrote: By my friend asking, for convenience, support to define multi

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

2014-06-13 Thread Tom Lane
Quan Zongliang quanzongli...@gmail.com 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.

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 t...@sss.pgh.pa.us: Quan Zongliang quanzongli...@gmail.com writes: CREATE OR

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

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 and...@2ndquadrant.com: 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

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

2014-06-13 Thread Tom Lane
Andres Freund and...@2ndquadrant.com 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

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

2014-06-13 Thread David G Johnston
Tom Lane-2 wrote Andres Freund lt; andres@ gt; 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

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

2014-06-13 Thread Tom Lane
David G Johnston david.g.johns...@gmail.com 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

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 := 'a1';

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 t...@sss.pgh.pa.us: David G Johnston david.g.johns...@gmail.com 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

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 t...@sss.pgh.pa.us wrote: David G Johnston david.g.johns...@gmail.com 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