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