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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/707263542e571c9906549e196728ad39ecc0ca84
Modified Files
--------------
src/backend/parser/gram.y | 34 ++++++++++++++++++++++++++----
src/test/regress/expected/namespace.out | 4 +-
2 files changed, 31 insertions(+), 7 deletions(-)