From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix deparsing of AT TIME ZONE and similar as FROM-clause functio
Date: Tue, 27 Oct 2026 21:24:51 +0000
Message-ID: <E1xLof5-000000012H8-0vQK@gemulon.postgresql.org> (raw)
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: https://postgr.es/m/CAAAe_zC68s-DwVX1o7C1HVcRk+Z+RTS6Vw19auZFfz=KaX8tZA@mail.gmail.com
Backpatch-through: 14
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/a44a4f1b6d11e1cb6061e70e112f688bf0a5dc85
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix deparsing of AT TIME ZONE and similar as FROM-clause functio
In-Reply-To: <E1xLof5-000000012H8-0vQK@gemulon.postgresql.org>
References: <E1xLof5-000000012H8-0vQK@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox