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 1riOSv-00GwWB-Ho for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2024 00:52:01 +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 1riOSu-009FeA-4r for pgsql-general@arkaria.postgresql.org; Fri, 08 Mar 2024 00:52:00 +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 1riOSt-009Fe1-Qs for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2024 00:52:00 +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 1riOSr-003LYQ-Rm for pgsql-general@lists.postgresql.org; Fri, 08 Mar 2024 00:51:59 +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 4280pm9I683605; Thu, 7 Mar 2024 19:51:49 -0500 From: Tom Lane To: "Peter J. Holzer" cc: pgsql-general@lists.postgresql.org Subject: Re: Thoughts on user-defined types for talk at Postgres conference? In-reply-to: <20240307211655.mqx2pmmyflyb2jlr@hjp.at> References: <506dd5f4-65fe-4d34-8cfe-2ebc08b978e4@Spark> <20240307211655.mqx2pmmyflyb2jlr@hjp.at> Comments: In-reply-to "Peter J. Holzer" message dated "Thu, 07 Mar 2024 22:16:55 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <683603.1709859108.1@sss.pgh.pa.us> Date: Thu, 07 Mar 2024 19:51:48 -0500 Message-ID: <683604.1709859108@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Peter J. Holzer" writes: > On 2024-03-06 12:45:33 -0500, Stephen Frost wrote: >> That's an additional 21 bytes, which is really quite a lot. What's >> included in those 21 bytes are >> [...] >> the type information (typmod if there is one and the OID of the >> composite type), > Is it necessary to store this in every row? Can a column contain > different composite types? Operations on type RECORD need to be able to ascertain which concrete rowtype they're dealing with, so yes the type info is critical in that case. Even without that, it wouldn't be terribly practical to insist on creating a separate copy of record_out (and every other function that accepts composite types) just so that it could have a hard-wired notion of what rowtype it's going to deal with. regards, tom lane