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 1t2bSF-005QZz-Jt for pgsql-general@arkaria.postgresql.org; Sun, 20 Oct 2024 19:19:07 +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 1t2bSD-000nM0-KB for pgsql-general@arkaria.postgresql.org; Sun, 20 Oct 2024 19:19:05 +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 1t2bSD-000nLi-9C for pgsql-general@lists.postgresql.org; Sun, 20 Oct 2024 19:19:05 +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.94.2) (envelope-from ) id 1t2bSB-0026Ds-CW for pgsql-general@lists.postgresql.org; Sun, 20 Oct 2024 19:19:05 +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 49KJJ0Cx1357718; Sun, 20 Oct 2024 15:19:00 -0400 From: Tom Lane To: Michel Pelletier cc: pgsql-general Subject: Re: Using Expanded Objects other than Arrays from plpgsql In-reply-to: References: <1342498.1729444411@sss.pgh.pa.us> Comments: In-reply-to Michel Pelletier message dated "Sun, 20 Oct 2024 11:25:30 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1357716.1729451940.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 20 Oct 2024 15:19:00 -0400 Message-ID: <1357717.1729451940@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michel Pelletier writes: > On Sun, Oct 20, 2024 at 10:13 AM Tom Lane wrote: >> The other problem is that plpgsql only knows how to do such expansion >> for arrays, and it's not obvious how to extend that part. > Perhaps a third member function for ExpandedObjectMethods that formalizes > the expansion interface like found in DatumGetExpandedArray? I closely > follow that same pattern in my code. The trouble is we don't have an expanded object to consult at this point --- only a flat Datum. plpgsql has hard-wired knowledge that it's okay to apply expand_array if the datatype passes the typisarray tests, but I'm pretty unclear on how to provide similar knowledge for extension datatypes. regards, tom lane