Using substr with user defined types

From: darcy(at)druid(dot)net (D'Arcy J(dot)M(dot) Cain)
To: pgsql-sql(at)PostgreSQL(dot)org
Subject: Using substr with user defined types
Date: 2000-05-16 11:37:22
Message-ID: m12rff8-000AXkC@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 store instead 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(at){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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Wallingford, Ted 2000-05-16 13:45:55 pattern matching operator
Previous Message Johann Spies 2000-05-16 08:51:03 Re: sanity check fails