I said:
> I would've expected it to count nested parentheses, at least.
Okay, it does that now, and I found that I could tighten the error
checking to give a sooner/more useful error. Now, if you get caught
by the integer-FOR-vs-FOR-over-rows problem, you'll probably get
ERROR: missing .. at end of SQL expression
which at least gives you some clue that the problem has something to
do with the "FOR x IN foo .. bar" syntax.
regards, tom lane