Problem with BYTEA, CAST, and pg_dump

Поиск
Список
Период
Сортировка
От D. Dante Lorenso
Тема Problem with BYTEA, CAST, and pg_dump
Дата
Msg-id 471CE5CF.8080309@vocalspace.com
обсуждение исходный текст
Список 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



В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: Inheritance foreign key unexpected behaviour
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: [HACKERS] 8.2.3: Server crashes on Windows using Eclipse/Junit