Re: WIP: extensible enums - Mailing list pgsql-hackers

From Tom Lane
Subject Re: WIP: extensible enums
Date
Msg-id 23598.1287894367@sss.pgh.pa.us
Whole thread Raw
In response to Re: WIP: extensible enums  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: WIP: extensible enums
Re: WIP: extensible enums
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> I suppose you could fix this by always updating every row, and storing
> in each row the total count of elements (or a random number).  Then
> it'd be obvious if you'd read an inconsistent view of the world.

Well, the easy way to read a consistent view of the world is to load the
cache using an MVCC snapshot instead of SnapshotNow.  The current code
structure isn't amenable to that because it's relying on a syscache to
fetch the data for it, but that seems pretty inefficient anyway.  I'm
thinking of changing it around so that the enum cache gets loaded with
a regular systable_beginscan() scan, and then we could load with an
MVCC snapshot.

I'm kind of inclined to go to the float-based representation anyway,
though, just because not having to update other rows to do an insert
seems like a good thing.  But we could combine that with an MVCC
snapshot on the read side, which would make renumbering safe, which
would mean that we could auto-renumber when we ran out of code space
and not otherwise.  Is that getting too complicated?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: WIP: extensible enums
Next
From: Robert Haas
Date:
Subject: Re: patch: Add JSON datatype to PostgreSQL (GSoC, WIP)