Ensure we have a snapshot when updating pg_index in index_drop().
authorNathan Bossart <nathan@postgresql.org>
Mon, 28 Oct 2024 21:44:31 +0000 (16:44 -0500)
committerNathan Bossart <nathan@postgresql.org>
Mon, 28 Oct 2024 21:44:31 +0000 (16:44 -0500)
commit70b9adb98eab42bc12ddeea863be335b21b55675
tree739b33d41148acf62387cf8bad2882002134d27c
parent11b7de4a784135d7a9bce4a29ede092797749efc
Ensure we have a snapshot when updating pg_index in index_drop().

I assumed that all index_drop() callers set an active snapshot
beforehand, but that is evidently not true.  One counterexample is
autovacuum, which doesn't set an active snapshot when cleaning up
orphan temp indexes.  To fix, unconditionally push an active
snapshot before updating pg_index in index_drop().

Oversight in commit b52adbad46.

Reported-by: Masahiko Sawada
Reviewed-by: Stepan Neretin, Masahiko Sawada
Discussion: https://postgr.es/m/CAD21AoBgF9etQrXbN9or_YHsmBRJHHNUEkhHp9rGK9CyQv5aTQ%40mail.gmail.com
src/backend/catalog/index.c