Re: RPM question: Where to put psycopg2 files

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Federico Di Gregorio <federico(dot)digregorio(at)dndg(dot)it>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: RPM question: Where to put psycopg2 files
Date: 2011-01-17 15:01:51
Message-ID: AANLkTi=nrvt5wFMd3Qn+6w5CUp2DAO3OE2eb3dPd6faO@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Mon, Jan 17, 2011 at 1:53 PM, Federico Di Gregorio
<federico(dot)digregorio(at)dndg(dot)it> wrote:
> On 17/01/2011 14:35, Daniele Varrazzo wrote:
>> The problem is that postgres 9 uses by default the hex format instead
>> of the escape format to represent bytea
>> (http://www.postgresql.org/docs/9.0/static/datatype-binary.html) A
>> workaround I was thinking about could be to send "SET bytea_output TO
>> 'escape';" on connection in case of pre9-libpq/post9-server
>> combination is detected. I hate it because I was trying to drop the
>> "queries on connection" psycopg does (there used to be 3, now there is
>> only one and I think the last one can be dropped as well).
>
> Please lets not do that. psycopg can already be used with a lesser libpq
> to connect to a newer backend _unless_ changes like the one in this
> discussion. Solving this particular problem may seem a good thing but,
> IMHO, it is just putting a workaround in the wrong place.
>
>> Of course
>> bytea_output can be set in the postgresql.conf too and it would make
>> previous releases of psycopg work fine.
>
> That's the correct workaround.

A different workaround would be to have our own bytea hex format
parser if the libpq doesn't support it. It looks easy enough and
wouldn't be a security risk as it's only to receive data from the
backend: 9.0 servers understands escape format ok with both settings.

My fear is that not everybody would be able to set bytea_output to
escape in the server they have to talk to, and it looks 8.4 on the
clients is there to stay for a long while (referring to ubuntu, the
distro I'm more up-to-date, both the last LTS and the last 10.10 have
only 8.4 in the official repos, and things don't look different in the
upcoming natty - see
<http://packages.ubuntu.com/natty/postgresql-client>). If we decide
not to do anything we should at least document the toxic interaction
in a FAQ.

-- Daniele

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Harald Armin Massa 2011-01-17 15:08:38 Re: RPM question: Where to put psycopg2 files
Previous Message Daniele Varrazzo 2011-01-17 14:48:42 Re: RPM question: Where to put psycopg2 files