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 1rv7sN-009r3P-S6 for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Apr 2024 03:46:56 +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 1rv7sM-009PZ4-7t for pgsql-bugs@arkaria.postgresql.org; Fri, 12 Apr 2024 03:46:54 +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 1rv7sL-009PYw-QZ for pgsql-bugs@lists.postgresql.org; Fri, 12 Apr 2024 03:46:53 +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 1rv7sJ-002Rhm-Fo for pgsql-bugs@lists.postgresql.org; Fri, 12 Apr 2024 03:46:52 +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 43C3knlf330609; Thu, 11 Apr 2024 23:46:49 -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> <170712.1712844795@sss.pgh.pa.us> Comments: In-reply-to Richard Guo message dated "Fri, 12 Apr 2024 11:25:49 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <330607.1712893609.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 11 Apr 2024 23:46:49 -0400 Message-ID: <330608.1712893609@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Thu, Apr 11, 2024 at 10:13 PM Tom Lane wrote: >> 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. > Indeed. I did actually spend some time today trying to code that up, to see what it would look like. The attempt failed though, because there are existing cases in which get_expr_result_type() returns TYPEFUNC_RECORD, so we can't use that result code as a positive indicator that "this RTE has a coldeflist". In a green field we could invent another TYPEFUNC_XXX code, but that's not a back-patchable idea. So the new function would need some independent indicator that it saw a coldeflist, and at that point there's basically nothing we're hiding from the callers. >> 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. > Works for me. OK, barring other objections I'll push forward on that basis. regards, tom lane