Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> In addition, this seems to work:
> for intvar in 1 .. (select max(a) from a) LOOP
> and this doesn't:
> for intvar in 1 .. (select max(loop) from a) LOOP
> and this does:
> for intvar in (select max(loop) from a) .. 1 LOOP
> I'm guessing that plpgsql doesn't want to try to determine if
> an expression is valid and so just concats stuff to pass off,
Correct ...
> but that seems to mean that you need to double quote loop in
> the second (which is somewhat unobvious).
I would've expected it to count nested parentheses, at least.
A quick look makes it appear that some places in plpgsql's
gram.y do, and some don't. Ugh.
regards, tom lane