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/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general