Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group