On 2020-Aug-11, Alvaro Herrera wrote: > A much more troubling thought is what happens if the range is > desummarized, then the index item is used for the summary of a different > range. Then the index might end up returning corrupt results.
Actually, this is not a concern because the brin tuple's bt_blkno is rechecked before returning it, and if it doesn't match what we're searching, the loop is restarted. It becomes an infinite loop problem if the revmap is pointing to a tuple that's labelled with a different range's blkno. So I think my patch as posted is a sufficient fix for this problem. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services