"Tom Lane" <tgl@sss.pgh.pa.us> writes:
> "Steven Flatt" <steven.flatt@gmail.com> writes:
>> So, can we simply trust what's in pg_class.relpages and ignore looking
>> directly at the index?
>
> No, we can't. In the light of morning I remember more about the reason
> for the aforesaid patch: it's actually unsafe to read the pg_class row
> at all if you have not got lock on the index. We are reading with
> SnapshotNow in order to be sure we see up-to-date info, and that means
> that a concurrent update of the row (eg, for REINDEX to report the new
> relfilenode) can have the following behavior:
Should reindex be doing an in-place update? Don't we have to do in-place
updates for other system catalogs which are read in snapshotnow for precisely
the same reasons?
Alternatively, why does the planner need access to the pg_class entry and not
just the pg_index record?
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com