Re: Enum proposal / design - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Enum proposal / design
Date
Msg-id 29335.1155769321@sss.pgh.pa.us
Whole thread Raw
In response to Re: Enum proposal / design  (Tom Dunstan <pgsql@tomd.cc>)
List pgsql-hackers
Tom Dunstan <pgsql@tomd.cc> writes:
> Andrew Dunstan wrote:
>> I'm inclined to say let's keep it simple and stay with a fixed 4-byte 
>> global size.

> Fair enough. I'm ok with 4 bytes; 8 seemed a bit gratuitous.

If you're gonna fix it at 4 bytes, then I strongly suggest that the
value identifiers actually be OIDs assigned through the standard
OID-generating mechanism, and that the pg_enum table have the structure
standard system OID column    unique enum-value identifierenumtypid            OID of enum type it belongs toenumname
        name of enum value
 

unique indexes on:oid(enumtypid, enumname)

The advantage of doing this is that you can use the existing, well
debugged, normally-quite-fast mechanisms for generating new unique value
identifiers.  Rather than consing up your own slow full-table-scan
mechanism as envisioned in the original proposal.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Enum proposal / design
Next
From: "Jim C. Nasby"
Date:
Subject: Re: An Idea for planner hints