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 1ph7Pp-0000My-Bm for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 11:23:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ph7Po-00044v-8Z for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2023 11:23:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ph7Pn-00044m-Ck for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 11:22:59 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ph7Pj-0004QN-OA for pgsql-hackers@lists.postgresql.org; Tue, 28 Mar 2023 11:22:59 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id B4C7F3200911 for ; Tue, 28 Mar 2023 07:22:51 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 28 Mar 2023 07:22:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1680002571; x=1680088971; bh=j3d1tjoAqWUek owt0Eha6VOnXOl62fyngTdoEe41/x4=; b=SVmiMueO18Qmf1A3g4aW2P+14r+G0 8w6EmdgWkrgxNBoTt2b0ASY+stSKJ/AO+I34VBRp6ZQrmOjuWOobs67pgWXvLS84 KYabQW47l7l+suyH94WzSQLnv0WPNA/4Pl2ymbjUqBoGk1RlTSScvbECSkjY4YKi 3XszkEBamuWiuErcQQHmfJIoLuqURZAstCtFX/2/o6aSzO51tMXVyhMSdqPMzzfo qCDEDRddKNeDmo5YchYjP7ZoNLS65ypR8Z9W1Ksw7wnxAvRYf571BObMRyGvuFhG RusXh4fU36JNnS+KDV1fByEetS66/lHIAX2sZOKs1ueei2A9WR3KcsGvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehgedgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhephfejhedvgefhudefiefgtddtudetuddvgeevhfdvueefvdet gffhheffudfhgfejnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 28 Mar 2023 07:22:50 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 8EBE6386; Tue, 28 Mar 2023 13:22:48 +0200 (CEST) Date: Tue, 28 Mar 2023 13:22:48 +0200 From: Alvaro Herrera To: Pg Hackers Subject: "variable not found in subplan target list" Message-ID: <20230328112248.6as34mlx5sr4kltg@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: MERGE INTO public.target_parted as target_0 USING (select subq_0.c5 as c0, subq_0.c0 as c1, ref_0.a as c2, subq_0.c1 as c3, subq_0.c9 as c4, (select c from public.prt2_m_p3 limit 1 offset 1) as c5, subq_0.c8 as c6, ref_0.a as c7, subq_0.c7 as c8, subq_0.c1 as c9, pg_catalog.system_user() as c10 from public.itest1 as ref_0 left join (select ref_1.matches as c0, ref_1.typ as c1, ref_1.colname as c2, (select slotname from public.iface limit 1 offset 44) as c3, ref_1.matches as c4, ref_1.op as c5, ref_1.matches as c6, ref_1.value as c7, ref_1.op as c8, ref_1.op as c9, ref_1.typ as c10 from public.brinopers_multi as ref_1 where cast(null as polygon) <@ (select polygon from public.tab_core_types limit 1 offset 22) ) as subq_0 on (cast(null as macaddr8) >= cast(null as macaddr8)) where subq_0.c10 > subq_0.c2 limit 49) as subq_1 ON target_0.b = subq_1.c2 WHEN MATCHED AND (cast(null as box) |>> cast(null as box)) or (cast(null as lseg) ?-| (select s from public.lseg_tbl limit 1 offset 6) ) THEN DELETE WHEN NOT MATCHED AND (EXISTS ( select 21 as c0, subq_2.c0 as c1 from public.itest14 as sample_0 tablesample system (3.6) inner join public.num_exp_sqrt as sample_1 tablesample bernoulli (0.3) on (cast(null as "char") <= cast(null as "char")), lateral (select sample_1.id as c0 from public.a as ref_2 where (cast(null as lseg) <@ cast(null as line)) or ((select b3 from public.bit_defaults limit 1 offset 80) <> (select b3 from public.bit_defaults limit 1 offset 4) ) limit 158) as subq_2 where (cast(null as name) !~ (select t from public.test_tsvector limit 1 offset 5) ) and ((select bool from public.tab_core_types limit 1 offset 61) < (select pg_catalog.bool_or(v) from public.rtest_view1) ))) or (18 is NULL) THEN INSERT VALUES ( pg_catalog.int4um( cast(public.func_with_bad_set() as int4)), 13) WHEN MATCHED AND ((24 is not NULL) or (true)) or (cast(null as "timestamp") <= cast(null as timestamptz)) THEN UPDATE set b = target_0.b Ugh. I got no more SQL/JSON related crashes so far. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "No hay ausente sin culpa ni presente sin disculpa" (Prov. francés)