Re: Casting varchar to bytea

From: "Dylan Milks" <DMilks(at)greenridge(dot)ca>
To: "PostgreSQL (E-mail)" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Casting varchar to bytea
Date: 2003-09-12 19:59:21
Message-ID: 84D4D76946AC2F43AA9BDCD860DC667518C18E@voyager.greenridge-int.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks, that helped. This is what we did:

(to encode VARCHAR -> BYTEA)
update webuser set ccnum = decode(ccnumstring, 'escape') where userid=userid

(to decode BYTEA -> VARCHAR)
select encode(ccnum, 'escape') from webuser

But what about decrypting with the AES encryption algorithm?

Dylan

-----Original Message-----
From: Ian Barwick [mailto:barwick(at)gmx(dot)net]
Sent: Friday, September 12, 2003 2:36 PM
To: Dylan Milks; PostgreSQL (E-mail)
Subject: Re: [ADMIN] Casting varchar to bytea

On Friday 12 September 2003 20:39, Dylan Milks wrote:
> Hi. Could someone please tell me how to convert a "varchar" to a "bytea"
> datatype.
>
> I have a column which contains a number stored as a varchar. I have another
> column of type bytea. I'm trying to insert the value of the varchar column
> in the bytea column, but the conversion won't work.
>
> Something like the following:
>
> update webuser set ccnum = ccnumstring::bytea where userid=userid;
>
> Any ideas how to do this?

Does

update webuser set ccnum = decode(ccnumstring::text, 'encode')

work?

Ian Barwick
barwick(at)gmx(dot)net

Browse pgsql-admin by date

  From Date Subject
Next Message Héctor A. Albospino 2003-09-12 20:51:49 unsubscribe
Previous Message Bruno LEVEQUE 2003-09-12 19:45:20 Re: timestamp with timezone