Re: Using real libpq parameters - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Using real libpq parameters
Date
Msg-id AANLkTim7ft6n4YugJu0Xr+fdrYWOndzEZfzT=4tcBT6F@mail.gmail.com
Whole thread Raw
In response to Re: Using real libpq parameters  ("P. Christeas" <p_christ@hol.gr>)
List psycopg
On Sun, Feb 27, 2011 at 10:30 AM, P. Christeas <p_christ@hol.gr> wrote:

>  5. libpqtypes doesn't seem to help as you suggested. It does text->net-bin
> adaptations, which we don't need, since Python internal representation is
> already binary. We want a bin->net-bin library (where net-bin is the network
> Postgres-native format of data, heavily dependent on server's version)..

I have re-(re-re-)read the comments about the binary types in the
libpq documentation, and it's not as dire as I thought it was:

"""
Values passed in binary format require knowledge of the internal
representation expected by the backend. For example, integers must be
passed in network byte order. Passing numeric values requires
knowledge of the server storage format, as implemented in
src/backend/utils/adt/numeric.c::numeric_send() and
src/backend/utils/adt/numeric.c::numeric_recv().
"""

So *it is* an implementation leak, but it doesn't promise breakage at
every version. I will ask for further details on the postgres MLs to
try to get a better picture.

> OTOH, reading the code of libpqtypes /could/ help us write ourselves similar
> adapters.

This is true of course: even if we decided not to use libpqtypes
there's surely a lot to learn from it.

-- Daniele

psycopg by date:

Previous
From: "A.M."
Date:
Subject: Re: Using real libpq parameters
Next
From: Daniele Varrazzo
Date:
Subject: Re: Using real libpq parameters