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 1ruvB6-008Wly-NG for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Apr 2024 14:13:25 +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 1ruvB5-0014XQ-Pw for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Apr 2024 14:13:23 +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 1ruvB5-0014X9-Hv for pgsql-bugs@lists.postgresql.org; Thu, 11 Apr 2024 14:13:23 +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 1ruvAy-002MCd-Rq for pgsql-bugs@lists.postgresql.org; Thu, 11 Apr 2024 14:13:22 +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 43BEDF9R170713; Thu, 11 Apr 2024 10:13:15 -0400 From: Tom Lane To: Richard Guo cc: Tender Wang , exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18422: Assert in expandTupleDesc() fails on row mismatch with additional SRF In-reply-to: References: <18422-89ca86c8eac5246d@postgresql.org> <3861246.1712691263@sss.pgh.pa.us> <3917908.1712719937@sss.pgh.pa.us> <4019337.1712758601@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Thu, 11 Apr 2024 15:41:42 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <170711.1712844795.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 11 Apr 2024 10:13:15 -0400 Message-ID: <170712.1712844795@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Wed, Apr 10, 2024 at 10:16 PM Tom Lane wrote: >> Wilco. Another thing I was considering, but didn't pull the trigger >> on in the draft patch, was to introduce a funcapi.c function on the >> order of >> get_expr_result_rtfunc(RangeTblFunction *rtfunc, ...) >> which would encapsulate applying either BuildDescFromLists or >> get_expr_result_type. > Do you think we can have a parameter in the new get_expr_result_rtfunc() > function to indicate whether we want to build an intermediate tupdesc > when we have a coldeflist? Then we can set it to true in the two places > that are correct already, and set it to false at the places we need to > fix. But I'm not sure if including such a new parameter would be an > improvement or just make it worse. I did think about that, but it seems mighty weird. The semantics of the flag would have to be something like "I want a tupdesc when the result type is COMPOSITE, but not when it's RECORD", which seems rather arbitrary. Perhaps it'd be sufficient to add a note to the header comment of get_expr_result_type warning about when not to use it. regards, tom lane