Re: final light versions of Oracle compatibility (SQLSTATE, GREATEST, - Mailing list pgsql-patches

From Tom Lane
Subject Re: final light versions of Oracle compatibility (SQLSTATE, GREATEST,
Date
Msg-id 18081.1118379274@sss.pgh.pa.us
Whole thread Raw
In response to Re: final light versions of Oracle compatibility (SQLSTATE,  (Neil Conway <neilc@samurai.com>)
Responses Re: final light versions of Oracle compatibility (SQLSTATE,
List pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> Considering that the Bison manual suggests that it implements
> mid-rule actions by introducing an implicit bogus non-terminal ([1]),

Indeed ... and the reason that they bothered to do that is that mid-rule
actions are more understandable ;-).  A nonterminal that is not intended
to represent any real input, ever, is just plain weird.

> Unless we want two contiguous mid-rule actions
> (which is even _less_ readable), we'll need to futz with adding another
> member to %union to hold the two varnos the mid-rule action will
> produce.

Not at all.  The right way to do this, I think, is for the mid-rule
action to palloc the PLpgSQL_exception_block, fill the variables into
that, and return the block as its semantic value.  The end-of-rule
action then picks up the block and adds what it needs to.

One reason this is cleaner is that it scales to more SQLERRx variables
without further renumbering of the rule components.

            regards, tom lane

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: final light versions of Oracle compatibility (SQLSTATE,
Next
From: Volkan YAZICI
Date:
Subject: PQmakeEmptyPGresult() will return NULL if allocation fails