Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xUW24-000000010vw-3AwR for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Nov 2026 21:20:33 +0000 Received: from localhost ([127.0.0.1]:60188 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xUW23-0000000BfqG-1GG1 for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Nov 2026 21:20:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:45764) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xUW22-0000000Bfq4-3n7E for pgsql-bugs@lists.postgresql.org; Fri, 20 Nov 2026 21:20:30 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xUW20-00000000jIf-1zYT for pgsql-bugs@lists.postgresql.org; Fri, 20 Nov 2026 21:20:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 6AKLKQDY1714676; Fri, 20 Nov 2026 16:20:26 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 sss.pgh.pa.us 6AKLKQDY1714676 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sss.pgh.pa.us; s=default; t=1795209626; bh=ZxpgbECJPwGFFutRYA6sBQQJp5GB9ibHyjNEZ8p3WG0=; h=From:To:cc:Subject:In-reply-to:References:Date:From; b=SnsOkzzoF6LaLcgeLlTMXn5YN/Ytf+Y1qIe3sUOwVD5JPqof4T62y/6clIlEdFizR Qexa5t2xcJt8fb47rugRAMHzlHKJSksVD1hQMrXIK5BbQTi8z/fEEy8k2ASK93fZnd nfgdIA7oTJxWEfMz9FsskdqUz0W8Gqw0EBpZ5beI= From: Tom Lane To: hackerzheng666@gmail.com cc: pgsql-bugs@lists.postgresql.org, Robert Haas Subject: Re: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance In-reply-to: <1713251.1795207985@sss.pgh.pa.us> References: <19924-8aecd924385fafcc@postgresql.org> <1713251.1795207985@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 20 Nov 2026 15:53:05 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1714674.1795209626.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 20 Nov 2026 16:20:26 -0500 Message-ID: <1714675.1795209626@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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_pat= h) { parent_rel->partial_pathlist =3D 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