pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix under-parenthesized display of AT TIME ZONE constructs.
Date
Msg-id E1p0mZt-001aWf-QH@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix under-parenthesized display of AT TIME ZONE constructs.

In commit 40c24bfef, I forgot to use get_rule_expr_paren() for the
arguments of AT TIME ZONE, resulting in possibly not printing parens
for expressions that need it.  But get_rule_expr_paren() wouldn't have
gotten it right anyway, because isSimpleNode() hadn't been taught that
COERCE_SQL_SYNTAX parent nodes don't guarantee sufficient parentheses.
Improve all that.  Also use this methodology for F_IS_NORMALIZED, so
that we don't print useless parens for that.

In passing, remove a comment that was obsoleted later.

Per report from Duncan Sands.  Back-patch to v14 where this code
came in.  (Before that, we didn't try to print AT TIME ZONE that way,
so there was no bug just ugliness.)

Discussion: https://postgr.es/m/f41566aa-a057-6628-4b7c-b48770ecb84a@deepbluecap.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/de0ff6088e324f5f879c070e3369bc7ad8136b1b

Modified Files
--------------
src/backend/utils/adt/ruleutils.c         | 28 ++++++++++++++--------------
src/test/regress/expected/create_view.out |  8 +++++---
src/test/regress/sql/create_view.sql      |  1 +
3 files changed, 20 insertions(+), 17 deletions(-)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: revert: add transaction processing chapter with internals info
Next
From: Tom Lane
Date:
Subject: pgsql: Doc: word-smith the discussion of secure schema usage patterns.