UTF-8 context of BYTEA datatype??

Поиск
Список
Период
Сортировка
От Rafal Pietrak
Тема UTF-8 context of BYTEA datatype??
Дата
Msg-id 1148902558.14902.57.camel@model.home.waw.pl
обсуждение исходный текст
Ответ на Re: a row disapearing  (Rafal Pietrak <rafal@zorro.isa-geek.com>)
Ответы Re: UTF-8 context of BYTEA datatype??  (Peter Eisentraut <peter_e@gmx.net>)
Re: UTF-8 context of BYTEA datatype??  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Hi!

Within a UTF-8 encoded database, I have a table:
    CREATE TABLE pics (id serial not null unique, img bytea);

The table is originally initialized with a set of IDs. Then I'm using
perl-script to insert apropriate images by means of UPDATEing rows:
--------------within my script called 'job'-------------------
    my $db = DBI->connect('DBI:Pg:dbname=mydb') or die "DBI";
    my $z = $db->prepare("UPDATE pics set img=? where id=?") or die
"PREPARE";
    my $rc = $z->execute($content, $FILEID) or die "EXEC";
---------------------

But the result is somewhat unexpected:
---------------console output----------------------
DBD::Pg::st execute failed: ERROR:  invalid byte sequence for encoding
"UTF8": 0x89
EXEC at ./job line 22, <> chunk 1.
---------------------------------

How come the bytearea is *interpreted* as having encoding?

Or to put it the other way around: What column datatype should I use for
an opoque binary value?

(my postgres is 8.1.4)

--
-R

В списке pgsql-general по дате отправления:

Предыдущее
От: Roman Neuhauser
Дата:
Сообщение: Re: DB structure for logically similar objects in different states...
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: UTF-8 context of BYTEA datatype??