Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id WAA75204 for ; Wed, 17 May 2000 22:52:57 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id WAA21188; Wed, 17 May 2000 22:52:36 -0400 (EDT) To: darcy@druid.net (D'Arcy J.M. Cain) cc: pgsql-sql@postgresql.org Subject: Re: Using substr with user defined types In-reply-to: References: Comments: In-reply-to darcy@druid.net (D'Arcy J.M. Cain) message dated "Tue, 16 May 2000 07:37:22 -0400" Date: Wed, 17 May 2000 22:52:35 -0400 Message-ID: <21185.958618355@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200005/40 darcy@druid.net (D'Arcy J.M. Cain) writes: > I created a type (for passwords) but I can't seem to use substr. I > suppose that's because it is my own type because the errors suggest that > there is no substr (actually it says ltrim) function for that type. Yup --- the system has no idea how to apply any functions to a user-defined type except the ones you specifically define for that type. If you make a type-conversion function "text(yourtype) returns text" then the system will figure out that it should apply that function whenever you use your type as the argument of a function that needs text. But without such a function, the system will not assume that it can do anything text-ish with the datatype. regards, tom lane