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 1xUMBr-00000000vFW-05ry for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Nov 2026 10:49:59 +0000 Received: from localhost ([127.0.0.1]:59602 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xUMBp-000000080Ld-3bEK for pgsql-bugs@arkaria.postgresql.org; Fri, 20 Nov 2026 10:49:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:59646) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xUI4U-00000006I7a-3QzI for pgsql-bugs@lists.postgresql.org; Fri, 20 Nov 2026 06:26:06 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xUI4S-00000000cUM-36ng for pgsql-bugs@lists.postgresql.org; Fri, 20 Nov 2026 06:26:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=bSOqy0d8+B8n/dnX+lfOzGVJb/U8DocFcZAuK+4XW7A=; b=hwDmA+6fgPvSjPxLOeu0rdpYoM ekmmtob/i+gplWZHWYoHJQnjafyxhJ+H1ZISoxcjVY/+sl8hmhht/RQt2jUzIq43LLcT7CdgHXzk2 inmq0gaHrLSbDApcg8sjcBmwA5xqJm6nwSYLPykfgFWyrWXA2N/5NDpfENeg5GTvbTxsySmi9uQdv qmML6R/bgaWkJuzp4PH1c8klXTl5lbWuC+L/PDs7HQiMdKNRjSSK/tiFJHj/NoWcY17N2QXc40OUT 7UmdTPeIpAgwtgQJ6OSqPKllV7nOW/SS4FL+4M7XgBaPeD3KtRrp6t1iuEvxv41f3xrw46w/Cs/Y4 WPEzQ8kw==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xUI4S-00000001koM-1W7X for pgsql-bugs@lists.postgresql.org; Fri, 20 Nov 2026 06:26:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xUI4R-00000004OsV-0EYi for pgsql-bugs@lists.postgresql.org; Fri, 20 Nov 2026 06:26:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: hackerzheng666@gmail.com Reply-To: hackerzheng666@gmail.com, pgsql-bugs@lists.postgresql.org Date: Fri, 20 Nov 2026 06:25:27 +0000 Message-ID: <19924-8aecd924385fafcc@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19924 Logged by: Zheng Hacker Email address: hackerzheng666@gmail.com PostgreSQL version: 19.0 Operating system: Linux x86_64, Ubuntu 22.04.5, gcc 11.4.0, cassert Description: =20 Tested on git master (20devel) d94964f14f39936d69c6b8d3fc5020f0fdae1617 of 2026-11-20 and on an older unreleased master build. The version selected in this form is the closest option available; I did not test 19.0 or any released branch. 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. Fresh cluster, default settings: CREATE TABLE t1 (c0 int4, c1 int8); CREATE TABLE t3 (c0 int4, c1 interval); CREATE TABLE ch4 () INHERITS (t1); (SELECT json_populate_recordset(CAST('2147483647' AS oid), CAST('[]' AS json), FALSE) AS c0 FROM t3 AS a0 INNER JOIN t1 AS a1 USING (c0)) UNION (SELECT json_populate_recordset(CAST('2147483647' AS oid), CAST('[]' AS json), FALSE) AS c0 FROM t3 AS a0 INNER JOIN t1 AS a1 USING (c0)) LIMIT 2; ERROR: unrecognized node type: 3301232 With \set VERBOSITY verbose on master d94964f: ERROR: XX000: unrecognized node type: 3301232 LOCATION: create_plan_recurse, createplan.c:547 The number is the same on every run and for the variants below. What I ran, all on the same statement list (no tables are populated, all tables are empty): - git master d94964f (built from source, cassert): 3 of 3 fresh clusters give the error above. - An older, unreleased master build (cassert): 3 of 3 fresh clusters give the same error. - On master, each of these removals makes the error disappear (one run each, same cluster): replacing UNION with UNION ALL; removing LIMIT; using only one branch with LIMIT; INTERSECT instead of UNION; dropping the inheritance child ch4 before the query. Re-creating ch4 brings the error back. - The function matters: with generate_series(1,2), unnest(ARRAY[1,2]) or a plain column a0.c0 in place of json_populate_recordset(...) there is no error (one run each on master). With json_populate_recordset(NULL::t1, CAST('[]' AS json)) the same error with the same number 3301232 appears. Found by a statement-sequence fuzzer and reduced to the statements above. What I did not do: I did not trace where the Path node is freed or overwritten, I did not test a build without --enable-cassert (the error comes from elog, so I expect it there too, but I have not run it), and I did not test released branches.