agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Fix pg_overexplain to emit valid output with RANGE_TABLE option.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix pg_overexplain to emit valid output with RANGE_TABLE option.
@ 2026-04-16 05:16 Amit Langote <amitlan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Langote @ 2026-04-16 05:16 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pg_overexplain to emit valid output with RANGE_TABLE option.

overexplain_range_table() emitted the "Unprunable RTIs" and "Result
RTIs" properties before closing the "Range Table" group.  In the JSON
and YAML formats the Range Table group is rendered as an array of RTE
objects, so emitting key/value pairs inside it produced structurally
invalid output.  The XML format had a related oddity, with these
elements nested inside <Range-Table> rather than appearing as its
siblings.

These fields are properties of the PlannedStmt as a whole, not of any
individual RTE, so close the Range Table group before emitting them.
They now appear as siblings of "Range Table" in the parent Query
object, which is what was intended.

Also add a test exercising FORMAT JSON with RANGE_TABLE so that any
future regression in the output structure is caught.

Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHg+QDdDrdqMr98a_OBYDYmK3RaT7XwCEShZfvDYKZpZTfOEjQ@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6723d462db5a9ecea840b946f6b2843c20b1c866

Modified Files
--------------
contrib/pg_overexplain/expected/pg_overexplain.out | 121 ++++++++++++++++++++-
contrib/pg_overexplain/pg_overexplain.c            |  12 +-
contrib/pg_overexplain/sql/pg_overexplain.sql      |   6 +
3 files changed, 133 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix pg_overexplain to emit valid output with RANGE_TABLE option.
@ 2026-04-16 05:16 Amit Langote <amitlan@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Langote @ 2026-04-16 05:16 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix pg_overexplain to emit valid output with RANGE_TABLE option.

overexplain_range_table() emitted the "Unprunable RTIs" and "Result
RTIs" properties before closing the "Range Table" group.  In the JSON
and YAML formats the Range Table group is rendered as an array of RTE
objects, so emitting key/value pairs inside it produced structurally
invalid output.  The XML format had a related oddity, with these
elements nested inside <Range-Table> rather than appearing as its
siblings.

These fields are properties of the PlannedStmt as a whole, not of any
individual RTE, so close the Range Table group before emitting them.
They now appear as siblings of "Range Table" in the parent Query
object, which is what was intended.

Also add a test exercising FORMAT JSON with RANGE_TABLE so that any
future regression in the output structure is caught.

Reported-by: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>
Author: Satyanarayana Narlapuram <satyanarlapuram@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHg+QDdDrdqMr98a_OBYDYmK3RaT7XwCEShZfvDYKZpZTfOEjQ@mail.gmail.com
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/059cf7f58d23fc53423e4e58feaaa717faef53c5

Modified Files
--------------
contrib/pg_overexplain/expected/pg_overexplain.out | 122 ++++++++++++++++++++-
contrib/pg_overexplain/pg_overexplain.c            |  12 +-
contrib/pg_overexplain/sql/pg_overexplain.sql      |   6 +
3 files changed, 134 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-04-16 05:16 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-04-16 05:16 pgsql: Fix pg_overexplain to emit valid output with RANGE_TABLE option. Amit Langote <amitlan@postgresql.org>
2026-04-16 05:16 pgsql: Fix pg_overexplain to emit valid output with RANGE_TABLE option. Amit Langote <amitlan@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox