From: | Alvar Freude <alvar(at)a-blast(dot)org> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Cast text to bytea |
Date: | 2003-12-03 08:33:37 |
Message-ID: | 1188110000.1070440417@gnarzelwicht.delirium-arts.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I want to change a column from text to bytea; since it seems that alter
table can't change the column type, i have to add a temporary column and
copy the data from the old one to the new, delete the old and rename the
new.
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
The same with casting only:
odem=> SELECT 'abc'::text::bytea;
ERROR: Cannot cast type text to bytea
odem=> SELECT '\000'::text::bytea;
ERROR: Cannot cast type text to bytea
How can I do this?
encode/decode seems to handle only bytea data:
http://www.postgresql.org/docs/current/interactive/functions-string.html
And in http://www.postgresql.org/docs/current/static/datatype-binary.html I
also found no solution -- perhaps I missed something?
Thanks && 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/zZ/hOndlH63J86wRAmvoAJ4jwJp5R0nrmf8FzG9O599ED/8eCgCeOO2L
RpqleJNIv5RKvorYzh5+lo4=
=7mYs
-----END PGP SIGNATURE-----
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2003-12-03 09:03:30 | Re: Transaction Question |
Previous Message | David Garamond | 2003-12-03 08:27:14 | Re: Money data type in PostgreSQL? |