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.94.2) (envelope-from ) id 1tFeZF-00EgSG-6W for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Nov 2024 19:16:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tFeZD-00HJSI-QT for pgsql-bugs@arkaria.postgresql.org; Mon, 25 Nov 2024 19:16:15 +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.94.2) (envelope-from ) id 1tFeZD-00HJQr-Hf for pgsql-bugs@lists.postgresql.org; Mon, 25 Nov 2024 19:16:15 +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.94.2) (envelope-from ) id 1tFeZA-003jpS-TR for pgsql-bugs@lists.postgresql.org; Mon, 25 Nov 2024 19:16:14 +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 4APJGBx01440981; Mon, 25 Nov 2024 14:16:11 -0500 From: Tom Lane To: Dean Rasheed cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18722: Processing arrays with plpgsql raises errors In-reply-to: References: <18722-fd9e645448cc78b4@postgresql.org> <940942.1732412520@sss.pgh.pa.us> <1211277.1732488552@sss.pgh.pa.us> <1341819.1732547251@sss.pgh.pa.us> Comments: In-reply-to Dean Rasheed message dated "Mon, 25 Nov 2024 17:59:05 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1440979.1732562171.1@sss.pgh.pa.us> Date: Mon, 25 Nov 2024 14:16:11 -0500 Message-ID: <1440980.1732562171@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dean Rasheed writes: > I didn't mean do it in all cases, I just meant the NullIfExpr case > identified here. My point was that instead of modifying the evaluation > code for EEOP_NULLIF to make it call > MakeExpandedObjectReadOnlyInternal(), it would be easier to insert a > EEOP_MAKE_READONLY step for the first argument of the EEOP_NULLIF > step. But then the NULLIF step would only have access to the R/O pointer, no? We do want to pass on a R/W pointer to the output, if we got one, to handle cases like fconsumer(NULLIF(fproducer(...), ...), ...) Admittedly that's a pretty edgy edge-case, but still we're leaving money on the table if we don't do it. So I think we have to deal with the issue within NULLIF. regards, tom lane