From: | "D(dot) Dante Lorenso" <dante(at)vocalspace(dot)com> |
---|---|
To: | Postgres-General <pgsql-general(at)postgresql(dot)org> |
Subject: | Problem with BYTEA, CAST, and pg_dump |
Date: | 2007-10-22 18:02:55 |
Message-ID: | 471CE5CF.8080309@vocalspace.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2007-10-22 18:06:19 | Re: Bitmap Heap scan 8.1/8.2 |
Previous Message | Benjamin Weaver | 2007-10-22 18:00:38 | unicode searches failing that use % and LIKE operators |