pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. @ 2022-12-01 16:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2022-12-01 16:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1dd6700f44d2e14616d464a5f490552b7036ad3f 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. @ 2022-12-01 16:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2022-12-01 16:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a711b36e5b88e786f541b6c5671f28e997e68415 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. @ 2022-12-01 16:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2022-12-01 16:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-12-01 16:38 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-12-01 16:38 pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. Tom Lane <tgl@sss.pgh.pa.us> 2022-12-01 16:38 pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. Tom Lane <tgl@sss.pgh.pa.us> 2022-12-01 16:38 pgsql: Fix under-parenthesized display of AT TIME ZONE constructs. Tom Lane <tgl@sss.pgh.pa.us>
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