Re: UTF-8 context of BYTEA datatype??

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com>
Cc: Daniel Verite <daniel(at)manitou-mail(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: UTF-8 context of BYTEA datatype??
Date: 2006-05-30 20:47:05
Message-ID: 20060530204705.GE2708@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 30, 2006 at 10:26:31PM +0200, Rafal Pietrak wrote:
> Now, this is probably not exactly the furum to discuss that, but:
> 1. I did quite a few scripts with DBI, not only for Postgesql in fact -
> scripts worked flowlessly between Oracle/Sybase and the old DBASE files,
> too. And I have never fell into a problem of missing the an include for
> a particular driver - simple "use DBI;" did all the magic.
> 2. I admitt, that I should have spotted myself, that the
> DBD::Pg::PG_BYTEA might not have been recognized without the use
> clausure, but the driver itself understands prity much of the
> underlaying datatypes - I fon't need to bind explicitly for SQL_DATE or
> SQL_INTEGER. Why should I care more for binary objects?

Well actually, the driver doesn't understand any datatypes at all,
that's the problem. What's happening is that to send the query to the
server, the driver has to load all your paramters into the query string
and send it. And the server has to decode it all before it's even
looked at the string so it has no idea it's a bytea.

That's why bytea need special encoding to get around this check.

However, there is a solution: send the paramters seperate from the
query. In fact, postgres has been able to do that for a while now but
not all interfaces have been made to use it. My guess is that those
other databases you've used were already doing this so didn't see the
issue. I don't know if DBD:Pg does this though, maybe it needs to be
triggered somehow.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2006-05-30 20:52:21 Re: Restoring databases from a different installment on Windows
Previous Message Rafal Pietrak 2006-05-30 20:26:31 Re: UTF-8 context of BYTEA datatype??