On 2019-Jun-07, Robert Haas wrote:
> I spent some time today studying heapam_index_build_range_scan and
> quickly reached the conclusion that it's kind of a mess. At heart
> it's pretty simple: loop over all the table, check each tuple against
> any qual, and pass the visible ones to the callback. However, in an
> attempt to make it cater to various needs slightly outside of its
> original design purpose, various warts have been added, and there are
> enough of them now that I at least find it fairly difficult to
> understand. One of those warts is anyvisible, which I gather was
> added in support of BRIN.
Yes, commit 2834855cb9fd added that flag. SnapshotNonVacuumable did not
exist back then. It seems like maybe it would work to remove the flag
and replace with passing SnapshotNonVacuumable. The case that caused
that flag to be added is tested by a dedicated isolation test, so if
BRIN becomes broken by the change at least it'd be obvious ...
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services