Rule flag in gram.y

Started by Bruce Momjianover 24 years ago2 messageshackers
Jump to latest
#1Bruce Momjian
bruce@momjian.us

There is some code in gram.y that detects whether you are in a RULE so
NEW/OLD can be detected. Seems the value is reset on parser start and
set on RULE start, but not reset on rule and. A multi-query string
could use NEW/OLD in the queries after the RULE even though they are
invalid. The following patch fixes this by resetting the flag when the
rule action happens.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Attachments:

/pgpatches/ruletext/plainDownload+1-0
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: Rule flag in gram.y

Bruce Momjian <pgman@candle.pha.pa.us> writes:

There is some code in gram.y that detects whether you are in a RULE so
NEW/OLD can be detected. Seems the value is reset on parser start and
set on RULE start, but not reset on rule and. A multi-query string
could use NEW/OLD in the queries after the RULE even though they are
invalid. The following patch fixes this by resetting the flag when the
rule action happens.

I was about to say "fix ecpg's grammar too", but a quick look shows that
Michael was way ahead of the rest of us on this one ...

regards, tom lane