Re: [PATCHES] libpq type system 0.9a

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Jeff Davis" <pgsql(at)j-davis(dot)com>
Cc: "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Bruce Momjian" <bruce(at)momjian(dot)us>, "Andrew Chernow" <ac(at)esilo(dot)com>, "Joe Conway" <mail(at)joeconway(dot)com>, "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Merlin Moncure" <mmoncure(at)gmail(dot)com>, "PostgreSQL-development" <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [PATCHES] libpq type system 0.9a
Date: 2008-04-09 10:13:50
Message-ID: 87tzibibdt.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Jeff Davis" <pgsql(at)j-davis(dot)com> writes:

> * Binary formatting
>
> The exclusive use of binary formats is worrisome to me. This circumvents
> one level of indirection that we have (i.e. that everything moves
> through in/out functions), and will impose a backwards-compatibility
> requirement on the internal representation of data types, including
> user-defined data types. As far as I know, we currently have no such
> requirement, even for built-in types.

This is actually incorrect. Binary I/O still goes through a function call, the
send/recv functions instead of the in/out functions. In theory these are also
supposed to be cross-platform.

In practice they are, uhm, less cross-platform. For example they send floats
as raw (presumably) IEEE floats. There have also been fewer clients using
binary mode, so you're more likely to run into bugs.

But the reason fewer clients use binary mode is because they would have to
implement all this type-specific knowledge. It doesn't make sense to do it for
every driver or application but if you're implementing it once in a library it
does start to make more sense.

Note however that not every data type will necessarily provide a binary
send/recv function. The built-in data types do, but only as a matter of
policy. It's not an error to create a type with no binary i/o functions.
So I think you have to support using text mode as an option.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's RemoteDBA services!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gregory Stark 2008-04-09 11:24:19 Re: Concurrent psql API
Previous Message Gregory Stark 2008-04-09 10:07:39 Re: SET TRANSACTION not compliant with SQL:2003

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2008-04-09 11:24:19 Re: Concurrent psql API
Previous Message Gregory Stark 2008-04-09 08:46:26 Re: EXPLAIN progress info