]> granicus.if.org Git - postgresql/commit
Fix ecpg bugs caused by missing semicolons in the backend grammar.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Feb 2019 17:51:50 +0000 (12:51 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Feb 2019 17:51:50 +0000 (12:51 -0500)
commit8ec638e69c01e589a3e0c11fbe9ad21c0a3549f1
treee682e2ff3a79181a26eadf36d43057ebdf0a669f
parentbcf6278343444aa1de93b7c131b30c608a5b6e45
Fix ecpg bugs caused by missing semicolons in the backend grammar.

The Bison documentation clearly states that a semicolon is required
after every grammar rule, and our scripts that generate ecpg's
grammar from the backend's implicitly assumed this is true.  But it
turns out that only ancient versions of Bison actually enforce that.
There have been a couple of rules without trailing semicolons in
gram.y for some time, and as a consequence, ecpg's grammar was faulty
and produced wrong output for the affected statements.

To fix, add the missing semis, and add some cross-checks to ecpg's
scripts so that they'll bleat if we mess this up again.

The cases that were broken were:
* "SET variable = DEFAULT" (but not "SET variable TO DEFAULT"),
  as well as allied syntaxes such as ALTER SYSTEM SET ... DEFAULT.
  These produced syntactically invalid output that the server
  would reject.
* Multiple type names in DROP TYPE/DOMAIN commands.  Only the
  first type name would be listed in the emitted command.

Per report from Daisuke Higuchi.  Back-patch to all supported versions.

Discussion: https://postgr.es/m/1803D792815FC24D871C00D17AE95905DB51CE@g01jpexmbkw24
src/backend/parser/gram.y
src/interfaces/ecpg/preproc/check_rules.pl
src/interfaces/ecpg/preproc/parse.pl