Neil Conway <neilc@samurai.com> writes:
> Tom Lane wrote:
>> I still find the grammar changes to be an ugly kluge --- it should be
>> possible to do this without introducing bogus nonterminals.
> The scope-local variables need to be added to the namespace by the time
> that we parse the WHEN clauses. I can see two ways to do that: adding a
> bogus non-terminal, or using a mid-rule action. Mid-rule actions are
> pretty ugly, though. Is there a better alternative?
Right, mid-rule actions were what I had in mind. They're not uglier
than introducing empty nonterminals --- and in fact plpgsql's grammar
already relies on 'em. The cursor variable declaration production
(about line 359 in CVS tip) seems to me to offer a very direct parallel
to what we want to do here.
regards, tom lane