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 1pW1aI-00046i-Ku for pgsql-bugs@arkaria.postgresql.org; Sat, 25 Feb 2023 20:55:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pW1aH-0002bw-G0 for pgsql-bugs@arkaria.postgresql.org; Sat, 25 Feb 2023 20:55:57 +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 1pW1aH-0002bn-6w for pgsql-bugs@lists.postgresql.org; Sat, 25 Feb 2023 20:55:57 +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 1pW1aE-0001R6-Qn for pgsql-bugs@lists.postgresql.org; Sat, 25 Feb 2023 20:55:56 +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 31PKtoXY1416233; Sat, 25 Feb 2023 15:55:50 -0500 From: Tom Lane To: Andres Freund cc: Michael Paquier , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17800: ON CONFLICT DO UPDATE fails to detect incompatible fields that leads to a server crash In-reply-to: <20230225201942.bildwmfri625pugq@awork3.anarazel.de> References: <718944.1677189963@sss.pgh.pa.us> <20230223233636.zkt4tqzsc4b6ekwn@awork3.anarazel.de> <20230224015417.75yimxbksejpffh3@awork3.anarazel.de> <851179.1677259566@sss.pgh.pa.us> <20230224174412.xk3y364t6a2udp5t@awork3.anarazel.de> <1060251.1677276763@sss.pgh.pa.us> <20230224225357.2orpiokrfpjllfm4@awork3.anarazel.de> <1073422.1677282550@sss.pgh.pa.us> <20230224235704.jz5ayb37x6miml6v@awork3.anarazel.de> <1408832.1677354333@sss.pgh.pa.us> <20230225201942.bildwmfri625pugq@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sat, 25 Feb 2023 12:19:42 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1416231.1677358550.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 25 Feb 2023 15:55:50 -0500 Message-ID: <1416232.1677358550@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > Your commit message referenced commit 3f7323cbb, which contains: > That technique is borrowed from the far older code that supports > initplans, and it works okay in that case because the cloned SubPlan= nodes > are essentially identical. So it doesn't matter which one of the cl= ones > the shared ParamExecData.execPlan field might point to. Yeah, I now think that was a bit of a misstatement; not about the bug, but about what happens with initplans. > Out of curiosity: Are there cases where we actually overwrite execPlan f= or > initplans? I couldn't find any with a quick assertion. ISTM that that la= rgely > should be prevented by initplans being initialized once, in ExecInitNode= (). True. Even if an initplan is referenced in multiple places, it will be attached to just one plan node's initPlan list, so there should be only one time that execPlan gets set (per execution cycle of that node), and I think only one SubPlanState that it could point to. The references aren't SubPlan nodes, just Params. regards, tom lane