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 1u1qOE-008xve-3x for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Apr 2025 17:36:06 +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 1u1qNE-001y2A-GY for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Apr 2025 17:35:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u1qNE-001y21-6n for pgsql-hackers@lists.postgresql.org; Mon, 07 Apr 2025 17:35:04 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u1qNC-003xm6-19 for pgsql-hackers@postgresql.org; Mon, 07 Apr 2025 17:35:04 +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 537HYn1L3531058; Mon, 7 Apr 2025 13:34:49 -0400 From: Tom Lane To: Chapman Flack cc: PostgreSQL Hackers Subject: Re: FmgrInfo allocation patterns (and PL handling as staged programming) In-reply-to: <67F40ACD.7040507@acm.org> References: <67F2B767.9040507@acm.org> <2965818.1743960827@sss.pgh.pa.us> <2968353.1743962392@sss.pgh.pa.us> <67F40ACD.7040507@acm.org> Comments: In-reply-to Chapman Flack message dated "Mon, 07 Apr 2025 13:26:37 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3531056.1744047289.1@sss.pgh.pa.us> Date: Mon, 07 Apr 2025 13:34:49 -0400 Message-ID: <3531057.1744047289@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Chapman Flack writes: > This was really bumming me out. I thought "what on earth does that do > to the rest of your surrounding query, say if you have anyelement types > in the args or return value also?". > So the answer to that part is easy: if a routine's types include both > anyarray and anyelement (like, say, unnest), it just can't be applied > to one of those statistics columns. An attempt to use it that way in > a query is rejected early, before any attempt to call the routine: > ERROR: cannot determine element type of "anyarray" argument > STATEMENT: select unnest(stavalues1) from pg_statistic limit 1; Right. AFAIK the oddity doesn't "leak out" of functions taking anyarray. > That seems to make for a tidy way of recognizing the situation. If > you go to specialize and find anyarray among your supposedly-resolved > call-site types, well, you know you're in Wonderland and can adjust > behavior accordingly. Cool. regards, tom lane