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 1sMqhk-0050rH-Qe for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jun 2024 15:06:32 +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 1sMqhj-00AmPc-2Y for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jun 2024 15:06:31 +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 1sMqhi-00AmPN-On for pgsql-hackers@lists.postgresql.org; Thu, 27 Jun 2024 15:06:31 +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 1sMqhg-003P1e-FX for pgsql-hackers@lists.postgresql.org; Thu, 27 Jun 2024 15:06:29 +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 45RF6RF41734256; Thu, 27 Jun 2024 11:06:27 -0400 From: Tom Lane To: Marthin Laubscher cc: pgsql-hackers@lists.postgresql.org Subject: Re: Custom type's modifiers In-reply-to: <9964489E-E1FF-4E16-89D5-6804DD7C2A4B@lobeshare.co.za> References: <9964489E-E1FF-4E16-89D5-6804DD7C2A4B@lobeshare.co.za> Comments: In-reply-to Marthin Laubscher message dated "Thu, 27 Jun 2024 16:33:34 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1734254.1719500787.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 27 Jun 2024 11:06:27 -0400 Message-ID: <1734255.1719500787@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Marthin Laubscher writes: > But now I need to (re)define MyType to support type modifiers (e.g. MyTy= pe(1,14,18)) and I got that done using CREATE TYPE=E2=80=99s TYPMOD_IN and= TYPMOD_OUT parameters resulting in the correct packed value getting store= d in pg_attribute when I define a column of that type. = OK ... > But when I pass a MyType value to a function defined in my C extension h= ow would I access the type modifier value for the argument which could hav= e been drawn from the catalog or the result of a cast. = You can't. Whatever info is needed by operations on the type had better be embedded in the value. regards, tom lane