Re: extensible enum types - Mailing list pgsql-hackers

From Tom Lane
Subject Re: extensible enum types
Date
Msg-id 16830.1276888731@sss.pgh.pa.us
Whole thread Raw
In response to Re: extensible enum types  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: extensible enum types  (Andrew Dunstan <andrew@dunslane.net>)
Re: extensible enum types  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Insert a sort order column into pg_enum, and rearrange the values in
>> that whenever the user wants to add a new value in a particular place.
>> You give up cheap comparisons in exchange for flexibility.  I think lots
>> of people would accept that tradeoff, especially if they could make it
>> per-datatype.

> But I'm not happy about giving up cheap comparison.

I don't think it would be all that bad.  We could teach typcache.c to
cache the ordering data for any type that's in active use.  It'd
certainly be a lot more expensive than OID comparison, but perhaps not
worse than NUMERIC comparisons.

> And how would it be per data-type?

Well, there'd be two kinds of enums, just as you were saying before.
I'm not sure how we'd expose that to users exactly, or whether there
could be provisions for switching a type's behavior after creation.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: About tapes
Next
From: Tom Lane
Date:
Subject: Re: About tapes