From: Ian Barwick <barwick@gmx.net>
To: Dylan Milks <DMilks@greenridge.ca>
To: PostgreSQL (E-mail) <pgsql-admin@postgresql.org>
Subject: Re: Casting varchar to bytea
Date: Fri, 12 Sep 2003 21:36:19 +0200
Message-ID: <200309122136.19700.barwick@gmx.net> (raw)
In-Reply-To: <84D4D76946AC2F43AA9BDCD860DC667518C18D@voyager.greenridge-int.ca>
References: <84D4D76946AC2F43AA9BDCD860DC667518C18D@voyager.greenridge-int.ca>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: barwick@gmx.net, DMilks@greenridge.ca
Subject: Re: Casting varchar to bytea
In-Reply-To: <200309122136.19700.barwick@gmx.net>
References: <84D4D76946AC2F43AA9BDCD860DC667518C18D@voyager.greenridge-int.ca> <200309122136.19700.barwick@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox