pgsql: Fix JSON_TABLE PLAN deparse to keep parentheses around nested jo - Mailing list pgsql-committers

From Alexander Korotkov
Subject pgsql: Fix JSON_TABLE PLAN deparse to keep parentheses around nested jo
Date
Msg-id E1wjlei-000CeX-09@gemulon.postgresql.org
Whole thread
List 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@linux.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(-)


pgsql-committers by date:

Previous
From: noreply@postgresql.org
Date:
Subject: pgsql: Tag refs/tags/REL_19_BETA2 was created
Next
From: Alexander Korotkov
Date:
Subject: pgsql: postgres_fdw: don't push down non-relabeling ArrayCoerceExpr