Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ph8sa-0006vh-US for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 12:56:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ph8sZ-0005VN-Pz for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 12:56:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ph8sZ-0005VE-GM for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 12:56:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ph8sW-0002D8-Cq for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 12:56:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 32SCuf223460256; Tue, 28 Mar 2023 08:56:41 -0400 From: Tom Lane To: Alvaro Herrera cc: Pg Hackers Subject: Re: "variable not found in subplan target list" In-reply-to: <20230328112248.6as34mlx5sr4kltg@alvherre.pgsql> References: <20230328112248.6as34mlx5sr4kltg@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 28 Mar 2023 13:22:48 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3460254.1680008201.1@sss.pgh.pa.us> Date: Tue, 28 Mar 2023 08:56:41 -0400 Message-ID: <3460255.1680008201@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > I have to run now so can't dissect it, but while running sqlsmith on the > SQL/JSON patch after Justin's report, I got $SUBJECT in this query: I reduced this down to MERGE INTO public.target_parted as target_0 USING public.itest1 as ref_0 ON target_0.b = ref_0.a WHEN NOT MATCHED THEN INSERT VALUES (42, 13); The critical moving part seems to just be that the MERGE target is a partitioned table ... but surely somebody tested that before? regards, tom lane