| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix deparsing of AT TIME ZONE and similar as FROM-clause functio |
| Date: | 2026-10-27 21:24:51 |
| Message-ID: | E1xLof5-000000012H0-0bzW@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)gmail(dot)com>
Reviewed-by: Prashant Chinnam <crprashant(at)hotmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CAAAe_zC68s-DwVX1o7C1HVcRk+Z+RTS6Vw19auZFfz=KaX8tZA@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/17a0604c2d626fa4adb2a98f584fc6b7ee72e663
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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2026-10-27 21:37:07 | pgsql: Add PG_RETURN_ARG macro and use it for sum(int2) and sum(int4) |
| Previous Message | David Rowley | 2026-10-27 20:07:21 | pgsql: Reintroduce hash_mem cap on buckets in BuildTupleHashTable |