Re: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: hackerzheng666(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance
Date: 2026-11-20 20:53:05
Message-ID: 1713251.1795207985@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> A UNION (with duplicate elimination) of two identical queries, each with
> json_populate_recordset() in the select list over a join that involves a
> table with an inheritance child, together with a LIMIT, fails in the planner
> with an internal error whose node tag is a garbage number.

Yeah, that's pretty clearly a pfree'd Path node. I tried
git-bisecting this, and got an unhelpful-looking result:

8300d3ad4aa73dc6beec8dca7d9362dbc21c9a83 is the first bad commit
commit 8300d3ad4aa73dc6beec8dca7d9362dbc21c9a83 (HEAD)
Author: Robert Haas <rhaas(at)postgresql(dot)org>
Date: Mon Mar 9 08:16:30 2026 -0400

Consider startup cost as a figure of merit for partial paths.

I suspect what this is telling us is that the bug predates that,
but by chance this example didn't fail earlier because our cost
heuristics didn't lead us to choose the broken path.

Valgrind doesn't find anything useful either: it is able to
report use of an uninitialized value, but it doesn't track
where the lost Path was allocated or freed.

Not sure about a productive way to narrow this down :-(

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Christophe Pettus 2026-11-20 20:17:34 Re: BUG #19927: PostgreSQL 16: SQL dump adds experimental/incompatible options like \restrict