pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: hackerzheng666@gmail.com
Subject: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance
Date: Fri, 20 Nov 2026 06:25:27 +0000
Message-ID: <19924-8aecd924385fafcc@postgresql.org> (raw)

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:        

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.








view thread (6+ messages)  latest in thread

Message-ID: <19924-8aecd924385fafcc@postgresql.org>
Permalink:  ../19924-8aecd924385fafcc@postgresql.org/
Also on:    postgresql.org/message-id/19924-8aecd924385fafcc@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, hackerzheng666@gmail.com
  Subject: Re: BUG #19924: unrecognized node type in create_plan_recurse: UNION, LIMIT, json_populate_recordset, inheritance
  In-Reply-To: <19924-8aecd924385fafcc@postgresql.org>
  References: <19924-8aecd924385fafcc@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox