pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: darcy@druid.net
To: pgsql-sql@PostgreSQL.org
Subject: Using substr with user defined types
Date: Tue, 16 May 2000 07:37:22 -0400 (EDT)
Message-ID: <m12rff8-000AXkC@druid.net> (raw)

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@{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.



view thread (10+ messages)  latest in thread

Message-ID: <m12rff8-000AXkC@druid.net>
Permalink:  ../m12rff8-000AXkC@druid.net/
Also on:    postgresql.org/message-id/m12rff8-000AXkC@druid.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: darcy@druid.net
  Subject: Re: Using substr with user defined types
  In-Reply-To: <m12rff8-000AXkC@druid.net>
  References: <m12rff8-000AXkC@druid.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox