Re: Casting varchar to bytea - Mailing list pgsql-admin

From Ian Barwick
Subject Re: Casting varchar to bytea
Date
Msg-id 200309122136.19700.barwick@gmx.net
Whole thread Raw
In response to Casting varchar to bytea  ("Dylan Milks" <DMilks@greenridge.ca>)
List pgsql-admin
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@gmx.net


pgsql-admin by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Row locking during UPDATE
Next
From: "Dylan Milks"
Date:
Subject: Re: Casting varchar to bytea