]> granicus.if.org Git - postgresql/commit
Fix parse location tracking for lists that can be empty.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 4 Oct 2012 21:14:59 +0000 (17:14 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 4 Oct 2012 21:15:29 +0000 (17:15 -0400)
commit707263542e571c9906549e196728ad39ecc0ca84
tree2db731b1ed9f8eeb9b78d1d0a5cd41f542461600
parent7e389f73d1556fb21487cd28fe56cba1a91126e6
Fix parse location tracking for lists that can be empty.

The previous coding of the YYLLOC_DEFAULT macro behaved strangely for empty
productions, assigning the previous nonterminal's location as the parse
location of the result.  The usefulness of that was (at best) debatable
already, but the real problem is that in list-generating nonterminals like
OptFooList: /* EMPTY */ { ... } | OptFooList Foo { ... } ;
the initially-identified location would get copied up, so that even a
nonempty list would be given a bogus parse location.  Document how to work
around that, and do so for OptSchemaEltList, so that the error condition
just added for CREATE SCHEMA IF NOT EXISTS produces a sane error cursor.
So far as I can tell, there are currently no other cases where the
situation arises, so we don't need other instances of this coding yet.
src/backend/parser/gram.y
src/test/regress/expected/namespace.out