Re: Cast text to bytea

From: Alvar Freude <alvar(at)a-blast(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Cast text to bytea
Date: 2003-12-03 09:36:59
Message-ID: 1268530000.1070444219@gnarzelwicht.delirium-arts.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

- -- Alvar Freude <alvar(at)a-blast(dot)org> wrote:

> But it seems that Postgres can't cast text to bytea:
>
> odem=> UPDATE forum_gtree SET gid2=gid::bytea;
> ERROR: Cannot cast type text to bytea

I tryed it with DECODE:

odem=> UPDATE forum_gtree SET gid2=(DECODE(gid::text, 'escape'));
ERROR: decode: Bad input string for type bytea

hmmm ...

The text columns contains values from \x01 to \xff -- everything exept the
null byte.

So, hmmm, it seems I'm faster writing a small piece of Perl to convert this
then searching a solution ... ;)

Ciao
Alvar

- --
** Alvar C.H. Freude -- http://alvar.a-blast.org/
** Berufsverbot? http://odem.org/aktuelles/staatsanwalt.de.html
** ODEM.org-Tour: http://tour.odem.org/
** Informationsgesellschaft: http://www.wsis-koordinierungskreis.de/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/za68OndlH63J86wRAmE/AKCCaQU/YDFNv6fnri6D7I6Q74ts7QCfcqE1
S+I44j/Lx3mots/pt5EWBJE=
=LVOG
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ausrack Webmaster 2003-12-03 09:43:22 Re: DBD::Pg problem
Previous Message Alex Satrapa 2003-12-03 09:31:04 Re: DBD::Pg problem