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

From Andrew Dunstan
Subject Re: enum types and binary queries
Date
Msg-id 46D83055.3000109@dunslane.net
Whole thread Raw
In response to Re: enum types and binary queries  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers

Gregory Stark wrote:
> enum OIDs are unique across enums? This seems like a strange way to do it. I
> recall conversations about this a while back though and there were limitations
> of the type system that led to this, right?
>   

No, not the type system as such. It stems from this quote from Tom:

> If an output function depends on anything more than the contents of
> the object it's handed, it's vulnerable to being lied to.
> http://archives.postgresql.org/pgsql-hackers/2005-04/msg00998.php

So the value passed to the enum_out function has to be sufficiently 
unique to be able to look up the label. This arrangement got the best 
combination of compactness and simplicity that we could come up with at 
the time.

Incidentally, FWIW, I have heard tales of considerable speedup from 
people being able to avoid using FKs/lookup tables by using enums.

cheers

andrew



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: enum types and binary queries
Next
From: Decibel!
Date:
Subject: Re: Password requirement in windows installer