Re: WIP: extensible enums

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: WIP: extensible enums
Date: 2010-10-17 18:25:21
Message-ID: 4CBB3F91.4070803@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/17/2010 01:20 PM, Tom Lane wrote:
> I knew I shoulda read this patch ;-). That seems a lot more invasive
> than this feature justifies. And I share your qualms about whether it's
> race-condition-proof. We don't have very much locking on pg_type
> entries, so making a hard assumption about consistency between two
> different catalogs seems pretty risky.
>
> The way I'd be inclined to design this is that altering an enum doesn't
> change its pg_type entry at all, just add another row to pg_enum.
> When first needing to compare values of an enum, load up the typcache
> entry for it. This involves scanning all the entries for that type OID
> in pg_enum, and determining from that whether you can compare the easy
> way or not. If not, build the array that tells you how to sort, and put
> it in the typcache entry.

Perhaps mistakenly I wanted to avoid doing that as it would slow down a
retail comparison quite a lot, especially in the case of an enum with a
very large label set. That's why I put the sorted property and label
count in pg_type.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2010-10-17 19:03:49 Re: Floating-point timestamps versus Range Types
Previous Message Dean Rasheed 2010-10-17 18:19:30 Re: WIP: extensible enums