Using substr with user defined types - Mailing list pgsql-sql

From darcy@druid.net (D'Arcy J.M. Cain)
Subject Using substr with user defined types
Date
Msg-id m12rff8-000AXkC@druid.net
Whole thread Raw
Responses Re: Using substr with user defined types
List pgsql-sql
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.

The type is a password that takes a string on input and stores it as
a DES encrypted string.  In order for dump and reload to preserve the
passwords I did the following.
 - On output precede the string with a colon, an otherwise invalid character - On input strip the colon if present and
storeinstead of encrypting
 

My problem is that to use this value I need to strip the colon off and
I can't figure out how to do that.  I even wrote a second output function
called chkpass_rout but I can't seem to figure out how to access it.  I
get this error when I try to use it (after creating the function in SQL.

ERROR:  typeidTypeRelid: Invalid type - oid = 0

When I try to use substr I get this.

ERROR:  No such function 'substr' with the specified attributes

When I try to cast the field to text I get this.

ERROR:  No such function 'text' with the specified attributes

Can someone please tell me what I am missing here?

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.


pgsql-sql by date:

Previous
From: Johann Spies
Date:
Subject: Re: sanity check fails
Next
From: "Wallingford, Ted"
Date:
Subject: pattern matching operator