Re: pg_overexplain produces invalid JSON with RANGE_TABLE option - Mailing list pgsql-hackers

From Chao Li
Subject Re: pg_overexplain produces invalid JSON with RANGE_TABLE option
Date
Msg-id DFB98FAF-9D74-4B5D-8755-FBA8A5D14E36@gmail.com
Whole thread
In response to Re: pg_overexplain produces invalid JSON with RANGE_TABLE option  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: pg_overexplain produces invalid JSON with RANGE_TABLE option
List pgsql-hackers

> On Apr 16, 2026, at 08:06, Amit Langote <amitlangote09@gmail.com> wrote:
>
> Hi,
>
> On Thu, Apr 16, 2026 at 6:36 AM SATYANARAYANA NARLAPURAM
> <satyanarlapuram@gmail.com> wrote:
>>
>> Hi Hackers,
>>
>> It appears that pg_overexplain produces invalid JSON output when
>> EXPLAIN (FORMAT JSON, RANGE_TABLE) is used. The "Unprunable RTIs" and
>> "Result RTIs" properties are emitted as key:value pairs directly inside
>> the "Range Table" JSON array, which is structurally invalid.
>
> Thanks for the report and the patch.  That makes sense.
>
>> Attempted to fix this by moving ExplainCloseGroup() before the two overexplain_bitmapset()
>> calls, so the properties are emitted as siblings of "Range Table" in the parent object rather
>> than inside the array.
>>
>> Attached a patch to address this which also includes a test.
>
> I have added a commit message.  Will commit shortly to master and v18.
>
> --
> Thanks, Amit Langote
> <v1-0001-Fix-pg_overexplain-to-emit-valid-output-with-RANG.patch>

Hi Amit, as the commit message mentions YAML format as well, but I don’t find a test case in pg_overexplain.sql, would
itmake sense to also add a test case for YAML. I tried to add one, see the attached diff file. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/





Attachment

pgsql-hackers by date:

Previous
From: "Jack Bonatakis"
Date:
Subject: Re: Fix a server crash problem from pg_get_database_ddl
Next
From: Henson Choi
Date:
Subject: Re: Experimenting with wider Unicode storage