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 1tMVWl-004fog-2p for pgsql-general@arkaria.postgresql.org; Sat, 14 Dec 2024 17:02:03 +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 1tMVWg-004rNy-O5 for pgsql-general@arkaria.postgresql.org; Sat, 14 Dec 2024 17:01:59 +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 1tMVWg-004rNp-CM for pgsql-general@lists.postgresql.org; Sat, 14 Dec 2024 17:01:59 +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 1tMVWb-002pzu-4m for pgsql-general@lists.postgresql.org; Sat, 14 Dec 2024 17:01:58 +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 4BEH1nII1387151; Sat, 14 Dec 2024 12:01:50 -0500 From: Tom Lane To: Jan Behrens cc: pgsql-general@lists.postgresql.org Subject: Re: Allowed to return possibly TOASTed datums? In-reply-to: <20241214142827.fa730433d412246d424436e3@magnetkern.de> References: <20241214142827.fa730433d412246d424436e3@magnetkern.de> Comments: In-reply-to Jan Behrens message dated "Sat, 14 Dec 2024 14:28:27 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1387149.1734195709.1@sss.pgh.pa.us> Date: Sat, 14 Dec 2024 12:01:49 -0500 Message-ID: <1387150.1734195709@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jan Behrens writes: > Is it allowed to use the following function, assuming the data type is > TOASTable? > PG_FUNCTION_INFO_V1(mytype_pos); > Datum mytype_pos(PG_FUNCTION_ARGS) { > PG_RETURN_DATUM(GETARG_DATUM(0)); > } Absolutely. You can find things equivalent to that in the core code, I think. regards, tom lane