pgsql: Make index_set_state_flags() transactional - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: Make index_set_state_flags() transactional
Date
Msg-id E1lxgLp-0000rf-Gd@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make index_set_state_flags() transactional

3c84046 is the original commit that introduced index_set_state_flags(),
where the presence of SnapshotNow made necessary the use of an in-place
update.  SnapshotNow has been removed in 813fb03, so there is no actual
reasons to not make this operation transactional.

As reported by Andrey, it is possible to trigger the assertion of this
routine expecting no transactional updates when switching the pg_index
state flags, using a predicate mark as immutable but calling stable or
volatile functions.  83158f7 has been around for a couple of months on
HEAD now with no issues found related to it, so it looks safe enough for
a backpatch.

Reported-by: Andrey Lepikhov
Author: Michael Paquier
Reviewed-by: Anastasia Lubennikova
Discussion: https://postgr.es/m/20200903080440.GA8559@paquier.xyz
Discussion: https://postgr.es/m/9b905019-5297-7372-0ad2-e1a4bb66a719@postgrespro.ru
Backpatch-through: 9.6

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d3d0cbeb62320e0629596f6efb5921b36321c57f

Modified Files
--------------
src/backend/catalog/index.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Remove memory leaks in isolationtester.
Next
From: Michael Paquier
Date:
Subject: pgsql: Add test for CREATE INDEX CONCURRENTLY with not-so-immutable pre