]> granicus.if.org Git - postgresql/commit
Bend parse location rules for the convenience of pg_stat_statements.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 27 Mar 2012 19:17:00 +0000 (15:17 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 27 Mar 2012 19:17:41 +0000 (15:17 -0400)
commit5d3fcc4c2e137417ef470d604fee5e452b22f6a7
treedb37789bb9d6d85c6d3eaba28875b527c7e8c08f
parenta40fa613b516b97c37d87ac1b21fb7aa8a2f2c1b
Bend parse location rules for the convenience of pg_stat_statements.

Generally, the parse location assigned to a multiple-token construct is
the location of its leftmost token.  This commit breaks that rule for
the syntaxes TYPENAME 'LITERAL' and CAST(CONSTANT AS TYPENAME) --- the
resulting Const will have the location of the literal string, not the
typename or CAST keyword.  The cases where this matters are pretty thin on
the ground (no error messages in the regression tests change, for example),
and it's unlikely that any user would be confused anyway by an error cursor
pointing at the literal.  But still it's less than consistent.  The reason
for changing it is that contrib/pg_stat_statements wants to know the parse
location of the original literal, and it was agreed that this is the least
unpleasant way to preserve that information through parse analysis.

Peter Geoghegan
src/backend/parser/parse_coerce.c