From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Tweak parse location assignment for CURRENT_DATE and related con |
Date: | 2014-01-21 21:34:52 |
Message-ID: | E1W5iyC-00070p-3p@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Tweak parse location assignment for CURRENT_DATE and related constructs.
All these constructs generate parse trees consisting of a Const and
a run-time type coercion (perhaps a FuncExpr or a CoerceViaIO). Modify
the raw parse output so that we end up with the original token's location
attached to the type coercion node while the Const has location -1;
before, it was the other way around. This makes no difference in terms
of what exprLocation() will say about the parse tree as a whole, so it
should not have any user-visible impact. The point of changing it is that
we do not want contrib/pg_stat_statements to treat these constructs as
replaceable constants. It will do the right thing if the Const has
location -1 rather than a valid location.
This is a pretty ugly hack, but then this code is ugly already; we should
someday replace this translation with special-purpose parse node(s) that
would allow ruleutils.c to reconstruct the original query text.
(See also commit 5d3fcc4c2e137417ef470d604fee5e452b22f6a7, which also
hacked location assignment rules for the benefit of pg_stat_statements.)
Back-patch to 9.2 where pg_stat_statements grew the ability to recognize
replaceable constants.
Kyotaro Horiguchi
Branch
------
REL9_3_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/0950d67ee597797a5a93a00290d52fa7d34cffb7
Modified Files
--------------
src/backend/parser/gram.y | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-01-22 04:02:39 | pgsql: Allow type_func_name_keywords in even more places |
Previous Message | Robert Haas | 2014-01-21 17:42:08 | pgsql: Add a cardinality function for arrays. |