Re: Binary params in libpq

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Binary params in libpq
Дата
Msg-id 4D6AFCCC.1020603@postnewspapers.com.au
обсуждение исходный текст
Ответ на Re: Binary params in libpq  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Binary params in libpq  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-general
On 28/02/2011 7:48 AM, Merlin Moncure wrote:

>> How stable is the binary representation for the PostgreSQL types? We
>> may just pass bytea data in binary format and pass everything else as
>> text parameters, or pass different types too as binary, if performace
>> would benefit. Did binary format ever changed in the past (at least
>> since the introduction of the V3 protocol)?

AFAIK, the `timestamp' type moved from a floating-point to an integer
representation internally, which would've affected the binary protocol
representation. That was even a compile-time config option, so it could
be different between two different Pg installs with the same version.

>> Is such binary
>> representation more likely to change in the future respect to the
>> textual one, in a way that forward/backward compatibility between
>> server and client would be compromised?

History to date suggests that the binary representation certainly does
change. Then again, so has the textual one at least in the case of bytea.

> The binary representations of types are mostly stable.  On average of
> about one per release you might see a wire format change...it doesn't
> happen that often but you have to be prepared to deal with it.

Refusing to talk to databases newer than the version the driver was
tested with *might* be a good idea, just to be safe, though some kind of
user override would be needed. At least warn about it when you see a new
and unfamiliar Pg version. You can't always *tell* that a new
representation is incompatible, as the text-format bytea affair
demonstrated.

--
Craig Ringer

Tech-related writing at http://soapyfrogs.blogspot.com/

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

Предыдущее
От: Michael Harris
Дата:
Сообщение: ERROR: missing chunk number 0 for toast value 382548694 in pg_toast_847386
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: ERROR: invalid byte sequence for encoding "UTF8": 0xc35c