Re: Proposal: plpgsql - "for in array" statement - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Proposal: plpgsql - "for in array" statement
Date
Msg-id 7652.1285691705@sss.pgh.pa.us
Whole thread Raw
In response to Re: Proposal: plpgsql - "for in array" statement  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: Proposal: plpgsql - "for in array" statement  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>>>> FOR var IN [array variable | array expression]
>>>> LOOP
> How about distinguishing it this way:?
> FOR var IN ARRAY array_expression LOOP

That occurred to me too, but it's got a small problem: it's not
impossible for ARRAY to be the first token of a valid scalar expression.

But I guess you could get around that if you had to by putting the ARRAY
expression inside parens, and it would be a pretty darn unusual case
anyway.  So this is probably the best choice.  I'm not thrilled with
David's suggestions of using FOREACH or ITERATE --- using a different
initial keyword makes it awkward to make generic statements about "all
types of FOR loop".
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Proposal: plpgsql - "for in array" statement
Next
From: Tom Lane
Date:
Subject: Re: trailing whitespace in psql table output