pgsql: Fix deparsing of AT TIME ZONE and similar as FROM-clause functio
Fix deparsing of AT TIME ZONE and similar as FROM-clause functions.
ruleutils.c's looks_like_function() assumed that all COERCE_SQL_SYNTAX
cases produce output that looks like a function call (or at least
like one of the syntaxes the func_expr_windowless production accepts).
But AT TIME ZONE, AT LOCAL, OVERLAPS and IS xxx NORMALIZED print as
other sorts of a_expr, so those cases would produce invalid SQL syntax
when used in a FROM clause. Extend the logic to detect which specific
functions are safe or unsafe.
Author: Henson Choi <assam258@gmail.com>
Reviewed-by: Prashant Chinnam <crprashant@hotmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: /messages/by-id/CAAAe_zC68s-DwVX1o7C1HVcRk+Z+RTS6Vw19auZFfz=KaX8tZA@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/35a8ff7ae64d15dc028c1e33d404738fcaa8d629
Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 51 +++++++++++++++++++++++++++++--
src/test/regress/expected/create_view.out | 33 +++++++++++---------
src/test/regress/sql/create_view.sql | 3 +-
3 files changed, 68 insertions(+), 19 deletions(-)