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

From Tom Lane
Subject Re: enum types and binary queries
Date
Msg-id 8516.1188501688@sss.pgh.pa.us
Whole thread Raw
In response to Re: enum types and binary queries  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: enum types and binary queries  ("korry.douglas" <korry.douglas@enterprisedb.com>)
Re: enum types and binary queries  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Merlin Moncure wrote:
>> I noticed that enums are not available to be queried as binary through
>> the protocol.

> The trouble is that an enum doesn't have an immutable internal binary value.

> I guess we could say that the binary value is the integer offset of the 
> value in the enum ordering, and translate it back on input. Providing 
> the binary IO funcs shouldn't be too hard if we do that, unless I'm 
> missing something.

That would be expensive to get, wouldn't it?  The main point of binary
I/O is to be fast, so I'm not excited about an expensive conversion.

What if we just defined the binary format as being identical to the text
format, ie, the enum label?  A bit silly but at least it would eliminate
the gotcha that binary I/O fails.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: enum types and binary queries
Next
From: "korry.douglas"
Date:
Subject: Re: enum types and binary queries