Re: WIP: extensible enums
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>, Dean Rasheed <dean.a.rasheed@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2010-10-24T04:26:07Z
Lists: 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