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.96) (envelope-from ) id 1x2Vp1-005oMi-0O for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Sep 2026 15:27:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x2Vp0-007aM0-01 for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Sep 2026 15:27:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x2Voz-007aLr-2O for pgsql-bugs@lists.postgresql.org; Fri, 04 Sep 2026 15:27:17 +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 1x2Vox-00000003ztK-0Olz for pgsql-bugs@lists.postgresql.org; Fri, 04 Sep 2026 15:27:16 +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 684FRBfN1570205; Fri, 4 Sep 2026 11:27:11 -0400 From: Tom Lane To: 10215501441@stu.ecnu.edu.cn cc: Richard Guo , Robert Haas , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #19653: "variable not found in subplan target list" during planning with parallel parameterized nested loop, In-reply-to: <1564958.1788530496@sss.pgh.pa.us> References: <19653-9352cc6ba17b662f@postgresql.org> <1564958.1788530496@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 04 Sep 2026 10:01:36 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1570203.1788535631.1@sss.pgh.pa.us> Date: Fri, 04 Sep 2026 11:27:11 -0400 Message-ID: <1570204.1788535631@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > PG Bug reporting form writes: >> A query using a partitioned left/right join split, with >> `enable_partitionwise_join`, parallel settings, and `GROUP BY ROLLUP` fails >> at planning time with: >> ERROR: variable not found in subplan target list > Fascinating. For me, this fails *only* in v18, not earlier or later > branches. That's not a usual pattern for our bugs ... A bit of quality time with "git bisect" found that the misbehavior started at cc5d98525d43c22b98f360ef0f2c8d7dc57f04dc is the first bad commit commit cc5d98525d43c22b98f360ef0f2c8d7dc57f04dc Author: Richard Guo Date: Thu Mar 13 16:36:03 2025 +0900 Fix incorrect handling of subquery pullup and was fixed by 014f9a831a320666bf2195949f41710f970c54ad is the first new commit commit 014f9a831a320666bf2195949f41710f970c54ad Author: Robert Haas Date: Fri Dec 5 11:05:12 2025 -0500 Don't reset the pathlist of partitioned joinrels. The proximate cause of the failure is that we have a NestLoopParam containing a Var, which we need to find in the tlist of the nestloop's outer relation, but what is in the tlist is a PlaceHolderVar wrapping that Var. So it's possible to see some connection to cc5d98525, but it seems entirely accidental that 014f9a831 fixed it. I bet there are related cases that are still broken. regards, tom lane