Using substr with user defined types

Поиск
Список
Период
Сортировка
От darcy@druid.net (D'Arcy J.M. Cain)
Тема Using substr with user defined types
Дата
Msg-id m12rff8-000AXkC@druid.net
обсуждение исходный текст
Ответы Re: Using substr with user defined types  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Johann Spies
Дата:
Сообщение: Re: sanity check fails
Следующее
От: "Wallingford, Ted"
Дата:
Сообщение: pattern matching operator