Re: enum types and binary queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: enum types and binary queries
Date: 2007-08-30 19:21:28
Message-ID: 8516.1188501688@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message korry.douglas 2007-08-30 19:47:24 Re: enum types and binary queries
Previous Message Tom Lane 2007-08-30 18:58:48 Re: enum types and binary queries

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2007-08-30 19:39:59 Re: HOT patch - version 14
Previous Message Tom Lane 2007-08-30 18:58:48 Re: enum types and binary queries