pgsql: Ensure we have a snapshot when updating pg_index in index_drop()

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Ensure we have a snapshot when updating pg_index in index_drop()
Date: 2024-10-28 21:45:36
Message-ID: E1t5XYO-002uBV-JN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/70b9adb98eab42bc12ddeea863be335b21b55675

Modified Files
--------------
src/backend/catalog/index.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-10-28 23:42:29 pgsql: Fix dependency of partitioned table and table AM with CREATE TAB
Previous Message Alexander Korotkov 2024-10-28 19:42:52 Re: pgsql: Implement pg_wal_replay_wait() stored procedure