Completely transparent casts

From: Joachim Zobel <jzobel(at)heute-morgen(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Completely transparent casts
Date: 2004-12-15 18:41:21
Message-ID: 1103094247.3659.8.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi.

I have a
CREATE TYPE ccnumber AS (
length SMALLINT,
tail VARCHAR(4),
encrypt TEXT
);
for credit card number storage. I would like this to be completely
transparent. However I can not get it to be a drop in replacement for a
text type, no matter what casts I create. I always have to do something
like

CREATE TABLE cc_test (
test ccnumber
);

INSERT INTO cc_test(test) VALUES (to_ccnumber('1234567890128'));

SELECT ''||test, test FROM cc_test;

Is there a trick I did not find yet?

Sincerely,
Joachim

--
"... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden
koennen." - Bertolt Brecht - Leben des Galilei

Browse pgsql-general by date

  From Date Subject
Next Message Frank D. Engel, Jr. 2004-12-15 19:09:45 Re: Corrupt RTREE index
Previous Message Larry White 2004-12-15 18:17:36 Re: transactions, functions, foreign keys