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 21:20:26
Message-ID: 1714675.1795209626@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

I made a little further progress with gdb, and determined that
the missing path is (unsurprisingly at this point) a partial
path, for which we still have a Gather path, and that path
is getting chosen. This makes the failure go away:

diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 3af494f269d..49803a325d6 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -863,7 +863,6 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path)
{
parent_rel->partial_pathlist =
foreach_delete_current(parent_rel->partial_pathlist, p1);
- pfree(old_path);
}
else
{

but of course that's likely to be an unacceptably memory-hungry
solution.

What I think must be happening here is that we are building
Gather paths before we have finished letting the add_partial_path
tournament run. This is a Bad Thing just from the point of view
of wasted cycles, never mind dangling pointers. We should wait
till all the partial paths are made for a rel, and only then
build Gather paths atop the surviving partial paths.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2026-11-20 22:18:38 Re: Segfaults in 18 and 19 when pgstats can't grow its DSA (back-patch of d9de60c5e4)
Previous Message Tom Lane 2026-11-20 20:53:05 Re: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance