pgsql: Fix parse location tracking for lists that can be empty. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix parse location tracking for lists that can be empty.
Date
Msg-id E1TJslo-0004IA-B7@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix permissions explanations in CREATE DATABASE and CREATE SCHEM
Next
From: Tom Lane
Date:
Subject: pgsql: Make CREATE AGGREGATE complain if the initcond is invalid for th