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 1malH9-00079I-30 for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Oct 2021 20:54:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1malH8-00068q-0O for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Oct 2021 20:54:58 +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 1malH7-00062P-PH for pgsql-bugs@lists.postgresql.org; Wed, 13 Oct 2021 20:54: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 1malH5-00041r-QK for pgsql-bugs@lists.postgresql.org; Wed, 13 Oct 2021 20:54: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 19DKsqXv676465; Wed, 13 Oct 2021 16:54:52 -0400 From: Tom Lane To: Alvaro Herrera cc: bernddorn@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17227: segmentation fault with jsonb_to_recordset In-reply-to: <675396.1634157283@sss.pgh.pa.us> References: <202110131359.a6m35hpudkg7@alvherre.pgsql> <649678.1634135335@sss.pgh.pa.us> <675396.1634157283@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 13 Oct 2021 16:34:43 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <676463.1634158492.1@sss.pgh.pa.us> Date: Wed, 13 Oct 2021 16:54:52 -0400 Message-ID: <676464.1634158492@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > This works OK in v12, so somebody broke it between v12 and v13. Looks like the somebody was me. git bisect pins the blame on commit 7266d0997dd2a0632da38a594c78e25ff21df67e Author: Tom Lane Date: Thu Aug 1 18:50:22 2019 -0400 Allow functions-in-FROM to be pulled up if they reduce to constants. A relevant-looking part of the commit message is To do this, we need to rearrange when eval_const_expressions() happens for expressions in function RTEs. I moved it to inline_set_returning_functions(), which already has to iterate over every function RTE, and in consequence renamed that function to preprocess_function_rtes(). Apparently this idea failed to account for subexpressions pulled up during later processing. Back to the drawing board. regards, tom lane