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 1pUbEY-0006Vs-RU for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Feb 2023 22:35:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pUbDZ-0004LV-NZ for pgsql-bugs@arkaria.postgresql.org; Tue, 21 Feb 2023 22:34:37 +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 1pUbDZ-0004Ju-Ev for pgsql-bugs@lists.postgresql.org; Tue, 21 Feb 2023 22:34:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pUbDX-00030Z-CB for pgsql-bugs@lists.postgresql.org; Tue, 21 Feb 2023 22:34:37 +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 31LMYUxt4060952; Tue, 21 Feb 2023 17:34:30 -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: <20230221221602.42n3pheoafjsmouj@awork3.anarazel.de> References: <17800-ff90866b3906c964@postgresql.org> <20230221193352.mvzpuvoujfmckvr3@awork3.anarazel.de> <3990862.1677010571@sss.pgh.pa.us> <20230221204201.idad3kjv3ue7gb6s@awork3.anarazel.de> <3995669.1677012915@sss.pgh.pa.us> <20230221221602.42n3pheoafjsmouj@awork3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 21 Feb 2023 14:16:02 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4060950.1677018870.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 21 Feb 2023 17:34:30 -0500 Message-ID: <4060951.1677018870@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On 2023-02-21 15:55:15 -0500, Tom Lane wrote: >> What I'm wondering about is adding a separate array, and likely a separ= ate >> ParamKind, that would have a less-than-query-wide scope. We might be a= ble >> to get away with having that be plan-node-wide, but making it local to = the >> specific compiled expression feels safer and easier to reason about. > What I was trying to suggest is that you could have a dedicated ExprCont= ext > that'd point to such a separate array. That'd allow you to choose the th= e > separate array on a per-expression-evaluation basis (not even per ExprSt= ate). > We already have multiple ExprContexts in some nodes, so this wouldn't br= eak > new ground. I'd really like to *not* need the surrounding plan node to know about this. The tlist push-down behavior shown upthread would result in that requirement propagating to just about every plan node type, certainly every one that allows projection. If we're certain that we'll only need this for MULTIEXPR_SUBLINK and thus only in tlists, we could conceivably put the support into ExecProject and friends rather than directly in the ExprState infrastructure. But that feels like a rather strange compromise, and it'd foreclose using the concept for other short-lifespan Param-like nodes. Another idea I'm toying with is that the expression compiler could allocate some space when it sees a MULTIEXPR_SUBLINK, and then connect up the multiexec Params to that. regards, tom lane