Search Postgresql Archives

Problem with BYTEA, CAST, and pg_dump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux