Re: enum types and binary queries - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: enum types and binary queries
Date
Msg-id 87odgn2554.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: enum types and binary queries  ("Merlin Moncure" <mmoncure@gmail.com>)
Responses Re: enum types and binary queries  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
"Merlin Moncure" <mmoncure@gmail.com> writes:

> On 8/30/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> "Merlin Moncure" <mmoncure@gmail.com> writes:
>> > I noticed that enums are not available to be queried as binary through
>> > the protocol.
>>
>> What do you think the binary representation ought to be?  Copying OIDs
>> seems pretty useless.
>
> I'm on the fence on this one.
>
> I actually think this would be ok, if you mean pg_enum.oid, or the
> string would be fine too.  I agree that binary protocol is supposed to
> be fast, and I can prefetch the pg_enum table to the client and do the
> magic there.  Many other binary formats do similarly inscrutable
> things.

I think it would be ok only if a pg_dump/pg_restore reliably restored the same
oid->enum value mapping. Otherwise a binary dump is useless. But as I
understand it that's the case currently, is it?

You would also have to have some way for a client to simply look up the enum
mapping. Something like an SRF that returned setof(oid,name).

My first instinct was to just use the enum name but I'm starting to think this
would be better. It is more in line with the promise of enums which is that
the names are just labels and the data internally is fixed size.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: enum types and binary queries
Next
From: Alvaro Herrera
Date:
Subject: Re: enum types and binary queries