Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> Hello, I noticed that pg_stat_statements.query can have funny values.
I don't think that's an acceptable reason for lobotomizing the parser's
ability to print error cursors, which is what your first patch does
(and without even any documentation that would keep someone from
changing it back).
The second patch might be all right, though I'm a bit disturbed by its
dependency on gram.h constants. The numeric values of those change on a
regular basis, and who's to say that these are exactly the set of tokens
that we care about?
In the end, really the cleanest fix for this would be to get rid of the
grammar's translation of these special functions into hacky expressions.
They ought to get translated into some new node type(s) that could be
reverse-listed in standard form by ruleutils.c. I've wanted to do that
for years, but never got around to it ...
regards, tom lane