From 3479ee2848c3022aa31d8b5a1ff3389b82eb13fe Mon Sep 17 00:00:00 2001
From: nkey <nkey@toloka.ai>
Date: Fri, 6 Sep 2024 13:17:51 +0200
Subject: [PATCH v1 2/2] Ensure the correct determination of index safety to be
 used with set_indexsafe_procflags during REINDEX CONCURRENTLY

---
 src/backend/commands/indexcmds.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index e07d279e2d..c34c550b4a 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -3783,8 +3783,8 @@ ReindexRelationConcurrently(const ReindexStmt *stmt, Oid relationOid, const Rein
 		RestrictSearchPath();
 
 		/* determine safety of this index for set_indexsafe_procflags */
-		idx->safe = (indexRel->rd_indexprs == NIL &&
-					 indexRel->rd_indpred == NIL);
+		idx->safe = (RelationGetIndexExpressions(indexRel) == NIL &&
+				RelationGetIndexPredicate(indexRel) == NIL);
 		if (idx->safe)
 			INJECTION_POINT("ReindexRelationConcurrently_index_safe");
 		idx->tableId = RelationGetRelid(heapRel);
-- 
2.43.0

