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_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a5e96ebe7caaa154814e52f771a2466947d17a39 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(-)
