BRIN autosummarization may need a snapshot

Álvaro Herrera <alvherre@kurilemu.de>

Commit: f0ad417161977d034e3d5845d043c44bef3d1f8a
Author: Álvaro Herrera <alvherre@kurilemu.de>
Date: 2025-11-04T12:23:26Z
Releases: 14.20
BRIN autosummarization may need a snapshot

It's possible to define BRIN indexes on functions that require a
snapshot to run, but the autosummarization feature introduced by commit
7526e10224f0 fails to provide one.  This causes autovacuum to leave a
BRIN placeholder tuple behind after a failed work-item execution, making
such indexes less efficient.  Repair by obtaining a snapshot prior to
running the task, and add a test to verify this behavior.

Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: Giovanni Fabris <giovanni.fabris@icon.it>
Reported-by: Arthur Nascimento <tureba@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/202511031106.h4fwyuyui6fz@alvherre.pgsql

Files

Discussion