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 ---------------------------(end of broadcast)--------------------------- TIP 7: You can help support the PostgreSQL project by donating at http://www.postgresql.org/about/donate