All,
I'm trying to use the crypt and decrypt functions from contrib and have
installed them into my database. The definition for crypt seems to
require that I use BYTEA datatype to input the data I need to encrypt.
All of my data is either TEXT or VARCHAR, though and not BYTEA.
I was trying to run a query like this from a trigger:
SELECT encrypt(NEW.card_number::bytea, 'password', 'bf')
INTO NEW.card_number_enc;
Problem is that a cast from VARCHAR to BYTEA didn't exist. I saw an
email thread that suggested I create the cast myself so I did:
CREATE CAST (VARCHAR TO BYTEA) WITHOUT FUNCTION;
And that worked. Now I can run the encrypt function above without a
problem.
However, when I use pg_dump and restore the dumped database, the CREAT
CAST is lost. Is this a bug with pg_dump or should I be doing something
different?
-- Dante
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
message can get through to the mailing list cleanly