Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Stephen Frost
* Itagaki Takahiro (itagaki.takah...@gmail.com) wrote: On Mon, Jan 24, 2011 at 13:05, Stephen Frost sfr...@snowman.net wrote: FOR var in ARRAY array_expression ... I like that a lot more than inventing a new top-level keyword, AFAIR, the syntax is not good at an array literal. FOR var

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: FOR keyword - please, look on thread about my proposal FOR-IN-ARRAY I did, and I still don't agree w/ using FOREACH. I work with FOUND variable, because I like a consistent behave with FOR statement. When FOUND is true after cycle, you are

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Pavel Stehule
2011/1/29 Stephen Frost sfr...@snowman.net: * Itagaki Takahiro (itagaki.takah...@gmail.com) wrote: On Mon, Jan 24, 2011 at 13:05, Stephen Frost sfr...@snowman.net wrote: FOR var in ARRAY array_expression ... I like that a lot more than inventing a new top-level keyword, AFAIR, the syntax

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Pavel Stehule
I'll try to redesign main cycle.        Thanks, please, can you look on code that I sent last time? Pavel                Stephen -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (GNU/Linux) iEUEARECAAYFAk1EAJwACgkQrzgMPqB3kig5bACdH0fm8Klh7Dq1GlICV/Z8yEd4

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: I don't see a problem too, but we didn't find a compromise with this syntax, so I left it. It is true, so current implementation of FOR stmt is really baroque and next argument is a compatibility with PL/SQL. My idea is so FOR stmt will be a

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: please, can you look on code that I sent last time? I'm looking at it now and I still don't like the big set of conditionals at the beginning which sets things up. I do think the loop is a bit better, but have you considered factoring out the

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Pavel Stehule
2011/1/29 Stephen Frost sfr...@snowman.net: * Pavel Stehule (pavel.steh...@gmail.com) wrote: I don't see a problem too, but we didn't find a compromise with this syntax, so I left it. It is true, so current implementation of FOR stmt is really baroque and next argument is a compatibility with

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Stephen Frost
* Pavel Stehule (pavel.steh...@gmail.com) wrote: You have a similar opinion like me about design this statement. But there are others with strong negative opinion. For someone ARRAY ARRAY should be a problem. So FOREACH is third way - more, it increase a possibility for enhancing plpgsql in

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Tom Lane
Stephen Frost sfr...@snowman.net writes: * Pavel Stehule (pavel.steh...@gmail.com) wrote: You have a similar opinion like me about design this statement. But there are others with strong negative opinion. For someone ARRAY ARRAY should be a problem. So FOREACH is third way - more, it increase

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: See also http://archives.postgresql.org/pgsql-hackers/2010-12/msg01579.php which tries to draw a clear distinction between what FOR does and what FOREACH does. Thanks for that, somehow I had missed that post previously. I think I can get behind the idea

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-29 Thread Pavel Stehule
2011/1/29 Stephen Frost sfr...@snowman.net: * Tom Lane (t...@sss.pgh.pa.us) wrote: See also http://archives.postgresql.org/pgsql-hackers/2010-12/msg01579.php which tries to draw a clear distinction between what FOR does and what FOREACH does. Thanks for that, somehow I had missed that post

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-26 Thread Itagaki Takahiro
On Mon, Jan 24, 2011 at 13:05, Stephen Frost sfr...@snowman.net wrote: FOR var in ARRAY array_expression ... I like that a lot more than inventing a new top-level keyword, AFAIR, the syntax is not good at an array literal. FOR var IN ARRAY ARRAY[1,2,5] LOOP ... And it was the only drawback

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-25 Thread Itagaki Takahiro
On Mon, Jan 24, 2011 at 20:10, Pavel Stehule pavel.steh...@gmail.com wrote: we have to iterate over array's items because it allow seq. access to array's data. I need a global index for function array_get_isnull. I can't to use a buildin functions like array_slize_size or array_get_slice,

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-25 Thread Pavel Stehule
2011/1/26 Itagaki Takahiro itagaki.takah...@gmail.com: On Mon, Jan 24, 2011 at 20:10, Pavel Stehule pavel.steh...@gmail.com wrote: we have to iterate over array's items because it allow seq. access to array's data. I need a global index for function array_get_isnull. I can't to use a buildin

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-24 Thread Pavel Stehule
2011/1/24 Stephen Frost sfr...@snowman.net: Pavel, * Pavel Stehule (pavel.steh...@gmail.com) wrote: I merge your changes and little enhanced comments. Thanks.  Reviewing this further- Why are you using 'FOREACH' here instead of just making it another variation of 'FOR'?  What is 'FOUND'

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-24 Thread Pavel Stehule
Hello Other comments- I don't like using 'i' and 'j', you really should use better variable names, especially in large loops which contain other loops.  I'd also suggest changing the outer loop to be equivilant to the number of iterations that will be done instead of the number of items

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-24 Thread Cédric Villemain
2011/1/24 Pavel Stehule pavel.steh...@gmail.com: Hello Other comments- I don't like using 'i' and 'j', you really should use better variable names, especially in large loops which contain other loops.  I'd also suggest changing the outer loop to be equivilant to the number of iterations

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-23 Thread Stephen Frost
Pavel, * Pavel Stehule (pavel.steh...@gmail.com) wrote: I merge your changes and little enhanced comments. Thanks. Reviewing this further- Why are you using 'FOREACH' here instead of just making it another variation of 'FOR'? What is 'FOUND' set to following this? I realize that might make

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-23 Thread Robert Haas
On Sun, Jan 23, 2011 at 9:49 PM, Stephen Frost sfr...@snowman.net wrote: Pavel, * Pavel Stehule (pavel.steh...@gmail.com) wrote: I merge your changes and little enhanced comments. Thanks.  Reviewing this further- Why are you using 'FOREACH' here instead of just making it another variation

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-23 Thread Stephen Frost
* Robert Haas (robertmh...@gmail.com) wrote: On Sun, Jan 23, 2011 at 9:49 PM, Stephen Frost sfr...@snowman.net wrote: Why are you using 'FOREACH' here instead of just making it another variation of 'FOR'? Uh oh. You just reopened the can of worms from hell. hahahaha. Apparently I missed

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-23 Thread Stephen Frost
* Robert Haas (robertmh...@gmail.com) wrote: Uh oh. You just reopened the can of worms from hell. Alright.. I'm missing what happened to this suggestion of using: FOR var in ARRAY array_expression ... I like that a lot more than inventing a new top-level keyword, for the same reasons that

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-21 Thread Pavel Stehule
Hello I merge your changes and little enhanced comments. Regards Pavel Stehule 2011/1/20 Stephen Frost sfr...@snowman.net: Greetings, * Pavel Stehule (pavel.steh...@gmail.com) wrote: attached patch contains a implementation of iteration over a array: I've gone through this patch and, in

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-20 Thread Pavel Stehule
2011/1/20 Stephen Frost sfr...@snowman.net: * Robert Haas (robertmh...@gmail.com) wrote: On Wed, Jan 19, 2011 at 6:04 PM, Stephen Frost sfr...@snowman.net wrote: I'm going to mark this returned to author with feedback. That implies you don't think it should be considered further for this

[HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-19 Thread Stephen Frost
Greetings, * Pavel Stehule (pavel.steh...@gmail.com) wrote: attached patch contains a implementation of iteration over a array: I've gone through this patch and, in general, it looks pretty reasonable to me. There's a number of places where I think additional comments would be good and maybe

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-19 Thread Robert Haas
On Wed, Jan 19, 2011 at 6:04 PM, Stephen Frost sfr...@snowman.net wrote: I'm going to mark this returned to author with feedback. That implies you don't think it should be considered further for this CommitFest. Perhaps you mean Waiting on Author? -- Robert Haas EnterpriseDB:

Re: [HACKERS] REVIEW: WIP: plpgsql - foreach in

2011-01-19 Thread Stephen Frost
* Robert Haas (robertmh...@gmail.com) wrote: On Wed, Jan 19, 2011 at 6:04 PM, Stephen Frost sfr...@snowman.net wrote: I'm going to mark this returned to author with feedback. That implies you don't think it should be considered further for this CommitFest. Perhaps you mean Waiting on