Completely transparent casts - Mailing list pgsql-general

From Joachim Zobel
Subject Completely transparent casts
Date
Msg-id 1103094247.3659.8.camel@localhost
Whole thread Raw
List 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


pgsql-general by date:

Previous
From: Larry White
Date:
Subject: Re: transactions, functions, foreign keys
Next
From: "Frank D. Engel, Jr."
Date:
Subject: Re: Corrupt RTREE index