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 <[email protected]> Reviewed-by: Prashant Chinnam <[email protected]> Reviewed-by: Tom Lane <[email protected]> Discussion: https://postgr.es/m/CAAAe_zC68s-DwVX1o7C1HVcRk+Z+RTS6Vw19auZFfz=kax8...@mail.gmail.com Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/7933cf45a001322d87e679993c4586ef09bf7e08 Modified Files -------------- src/backend/utils/adt/ruleutils.c | 55 +++++++++++++++++++++++++++++-- src/test/regress/expected/create_view.out | 33 ++++++++++--------- src/test/regress/sql/create_view.sql | 3 +- 3 files changed, 72 insertions(+), 19 deletions(-)
