X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 0315DD1B4F0 for ; Fri, 12 Sep 2003 19:38:06 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 39103-07 for ; Fri, 12 Sep 2003 16:37:35 -0300 (ADT) Received: from p15140235.pureserver.info (sql-info.de [217.160.166.164]) by svr1.postgresql.org (Postfix) with ESMTP id AD802D1B502 for ; Fri, 12 Sep 2003 16:37:33 -0300 (ADT) Received: from iwate.sql-info.de (pD951704A.dip.t-dialin.net [217.81.112.74]) (using SSLv3 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by p15140235.pureserver.info (Postfix) with ESMTP id 1A0E5E41; Fri, 12 Sep 2003 21:37:28 +0200 (CEST) From: Ian Barwick To: "Dylan Milks" , "PostgreSQL (E-mail)" Subject: Re: Casting varchar to bytea Date: Fri, 12 Sep 2003 21:36:19 +0200 User-Agent: KMail/1.5.1 References: <84D4D76946AC2F43AA9BDCD860DC667518C18D@voyager.greenridge-int.ca> In-Reply-To: <84D4D76946AC2F43AA9BDCD860DC667518C18D@voyager.greenridge-int.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200309122136.19700.barwick@gmx.net> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/222 X-Sequence-Number: 10310 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