Dean Rasheed <dean.a.rash...@gmail.com> writes: > On 17 October 2010 18:53, Tom Lane <t...@sss.pgh.pa.us> wrote: >> We could fix that with Dean's idea of reloading the cache whenever >> we see that we are being asked to compare a value we don't have in the >> cache entry. However, that assumes that we even notice that it's not >> in the cache entry. If we're trying to use "fast" comparison then we >> wouldn't notice that.
> That makes me think maybe the "fast" and "slow" comparisons should > both be done the same way, having a cache so that we notice > immediately if we get a new value. Actually ... the race conditions can be a lot worse than just a race. Consider begin; alter type myenum add 'some-value'; insert into mytab values('some-value'); rollback; If mytab has an index on the enum col, we now have an index entry that contains an enum value that isn't valid according to anybody, and nobody knows how to compare it. If that entry is near the root then the index is hopelessly corrupt: no one can tell which way to descend when comparing it to some valid value. I think what this says is that we cannot allow any manipulations that involve an uncommitted enum value. Probably the easiest way is to make the ALTER TYPE operation disallowed-inside-transaction-block. That's pretty ugly, but doesn't seem like a serious restriction in practice (though for example it'd mean we couldn't use it in pg_dump). I'm not sure if enforcing such a restriction helps much in terms of managing cache invalidations. Even with that, it seems possible to encounter index entries for values that you haven't yet noticed the invalidation message for. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers