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

From Darren Duncan
Subject Re: Proposal: plpgsql - "for in array" statement
Date
Msg-id 4CA299B6.5070306@darrenduncan.net
Whole thread Raw
In response to Re: Proposal: plpgsql - "for in array" statement  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Proposal: plpgsql - "for in array" statement
List pgsql-hackers
Alvaro Herrera wrote:
> What about
> 
> FOR EACH var IN array_expr LOOP ...
> 
> I think this requires reserving EACH, which could cause a regression for
> working code.  Maybe there's a way to make it work?

What about saying FOR-EACH instead?

A good general solution that I'd expect to not cause regressions is to separate 
multiple-word keywords with dashes rather than spaces.

Since unquoted identifiers don't have dashes, I think, and moreover because the 
whole FOR-EACH would occupy the first position of the statement rather than the 
first two, there should be no ambiguity.

Parsing should be easier, too, because keywords formatted like this would just 
be a single term rather than having infinite variations due to embedded whitespace.

-- Darren Duncan


pgsql-hackers by date:

Previous
From: Itagaki Takahiro
Date:
Subject: Re: [RRR] Commitfest: The Good, The Bad, and the Ugly
Next
From: Tom Lane
Date:
Subject: Re: Proposal: plpgsql - "for in array" statement