| From: | Alexander Korotkov <akorotkov(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix JSON_TABLE PLAN deparse to keep parentheses around nested jo |
| Date: | 2026-07-14 22:31:12 |
| Message-ID: | E1wjlei-000CeX-09@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix JSON_TABLE PLAN deparse to keep parentheses around nested joins
get_json_table_plan() parenthesized the child of a parent/child
(OUTER/INNER) plan only when that child was a sibling (UNION/CROSS)
join, not when it was itself a parent/child join. A plan such as
PLAN (p0 OUTER (p1 INNER p11)) was therefore deparsed as
PLAN (p0 OUTER p1 INNER p11), which does not parse back to the same
plan tree -- a dump/restore hazard. Parenthesize the child whenever it
is not a bare path name, matching the logic already used for the
operands of sibling joins.
Reported-by: Thom Brown <thom(at)linux(dot)com>
Discussion: https://postgr.es/m/CAA-aLv7aZGSExnbjJRw8eKkoXbu34TdoKLLA2gPye3aHjO5OSA@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/160ef2751b524cbc797e59642543790c4a8132ec
Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 3 ++-
src/test/regress/expected/sqljson_jsontable.out | 29 +++++++++++++++++++++++++
src/test/regress/sql/sqljson_jsontable.sql | 15 +++++++++++++
3 files changed, 46 insertions(+), 1 deletion(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Korotkov | 2026-07-14 22:59:41 | pgsql: postgres_fdw: don't push down non-relabeling ArrayCoerceExpr |
| Previous Message | noreply | 2026-07-14 20:36:44 | pgsql: Tag refs/tags/REL_19_BETA2 was created |