@@ -781,11 +781,9 @@ FindUsableIndexForReplicaIdentityFull(Relation localrel, AttrMap *attrmap)
781
781
{
782
782
bool isUsableIdx ;
783
783
Relation idxRel ;
784
- IndexInfo * idxInfo ;
785
784
786
785
idxRel = index_open (idxoid , AccessShareLock );
787
- idxInfo = BuildIndexInfo (idxRel );
788
- isUsableIdx = IsIndexUsableForReplicaIdentityFull (idxInfo , attrmap );
786
+ isUsableIdx = IsIndexUsableForReplicaIdentityFull (idxRel , attrmap );
789
787
index_close (idxRel , AccessShareLock );
790
788
791
789
/* Return the first eligible index found */
@@ -832,22 +830,22 @@ FindUsableIndexForReplicaIdentityFull(Relation localrel, AttrMap *attrmap)
832
830
* to sequential execution, which might not be a good idea in some cases.
833
831
*/
834
832
bool
835
- IsIndexUsableForReplicaIdentityFull (IndexInfo * indexInfo , AttrMap * attrmap )
833
+ IsIndexUsableForReplicaIdentityFull (Relation idxrel , AttrMap * attrmap )
836
834
{
837
835
AttrNumber keycol ;
838
836
839
837
/* Ensure that the index access method has a valid equal strategy */
840
- if (get_equal_strategy_number_for_am (indexInfo -> ii_Am ) == InvalidStrategy )
838
+ if (get_equal_strategy_number_for_am (idxrel -> rd_rel -> relam ) == InvalidStrategy )
841
839
return false;
842
840
843
841
/* The index must not be a partial index */
844
- if (indexInfo -> ii_Predicate != NIL )
842
+ if (! heap_attisnull ( idxrel -> rd_indextuple , Anum_pg_index_indpred , NULL ) )
845
843
return false;
846
844
847
- Assert (indexInfo -> ii_NumIndexAttrs >= 1 );
845
+ Assert (idxrel -> rd_index -> indnatts >= 1 );
848
846
849
847
/* The leftmost index field must not be an expression */
850
- keycol = indexInfo -> ii_IndexAttrNumbers [0 ];
848
+ keycol = idxrel -> rd_index -> indkey . values [0 ];
851
849
if (!AttributeNumberIsValid (keycol ))
852
850
return false;
853
851
@@ -865,7 +863,7 @@ IsIndexUsableForReplicaIdentityFull(IndexInfo *indexInfo, AttrMap *attrmap)
865
863
IndexAmRoutine * amroutine ;
866
864
867
865
/* The given index access method must implement amgettuple. */
868
- amroutine = GetIndexAmRoutineByAmId (indexInfo -> ii_Am , false);
866
+ amroutine = GetIndexAmRoutineByAmId (idxrel -> rd_rel -> relam , false);
869
867
Assert (amroutine -> amgettuple != NULL );
870
868
}
871
869
#endif
0 commit comments