9898#define RELATION_CHECKS \
9999( \
100100AssertMacro(RelationIsValid(indexRelation)), \
101- AssertMacro(PointerIsValid(indexRelation->rd_amroutine )), \
101+ AssertMacro(PointerIsValid(indexRelation->rd_indam )), \
102102AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \
103103)
104104
105105#define SCAN_CHECKS \
106106( \
107107AssertMacro(IndexScanIsValid(scan)), \
108108AssertMacro(RelationIsValid(scan->indexRelation)), \
109- AssertMacro(PointerIsValid(scan->indexRelation->rd_amroutine )) \
109+ AssertMacro(PointerIsValid(scan->indexRelation->rd_indam )) \
110110)
111111
112112#define CHECK_REL_PROCEDURE (pname ) \
113113do { \
114- if (indexRelation->rd_amroutine ->pname == NULL) \
114+ if (indexRelation->rd_indam ->pname == NULL) \
115115elog(ERROR, "function %s is not defined for index %s", \
116116 CppAsString(pname), RelationGetRelationName(indexRelation)); \
117117} while(0)
118118
119119#define CHECK_SCAN_PROCEDURE (pname ) \
120120do { \
121- if (scan->indexRelation->rd_amroutine ->pname == NULL) \
121+ if (scan->indexRelation->rd_indam ->pname == NULL) \
122122elog(ERROR, "function %s is not defined for index %s", \
123123 CppAsString(pname), RelationGetRelationName(scan->indexRelation)); \
124124} while(0)
@@ -203,14 +203,14 @@ index_insert(Relation indexRelation,
203203RELATION_CHECKS ;
204204CHECK_REL_PROCEDURE (aminsert );
205205
206- if (!(indexRelation -> rd_amroutine -> ampredlocks ))
206+ if (!(indexRelation -> rd_indam -> ampredlocks ))
207207CheckForSerializableConflictIn (indexRelation ,
208208 (HeapTuple )NULL ,
209209InvalidBuffer );
210210
211- return indexRelation -> rd_amroutine -> aminsert (indexRelation ,values ,isnull ,
212- heap_t_ctid ,heapRelation ,
213- checkUnique ,indexInfo );
211+ return indexRelation -> rd_indam -> aminsert (indexRelation ,values ,isnull ,
212+ heap_t_ctid ,heapRelation ,
213+ checkUnique ,indexInfo );
214214}
215215
216216/*
@@ -275,7 +275,7 @@ index_beginscan_internal(Relation indexRelation,
275275RELATION_CHECKS ;
276276CHECK_REL_PROCEDURE (ambeginscan );
277277
278- if (!(indexRelation -> rd_amroutine -> ampredlocks ))
278+ if (!(indexRelation -> rd_indam -> ampredlocks ))
279279PredicateLockRelation (indexRelation ,snapshot );
280280
281281/*
@@ -286,8 +286,8 @@ index_beginscan_internal(Relation indexRelation,
286286/*
287287 * Tell the AM to open a scan.
288288 */
289- scan = indexRelation -> rd_amroutine -> ambeginscan (indexRelation ,nkeys ,
290- norderbys );
289+ scan = indexRelation -> rd_indam -> ambeginscan (indexRelation ,nkeys ,
290+ norderbys );
291291/* Initialize information for parallel scan. */
292292scan -> parallel_scan = pscan ;
293293scan -> xs_temp_snap = temp_snap ;
@@ -329,8 +329,8 @@ index_rescan(IndexScanDesc scan,
329329
330330scan -> kill_prior_tuple = false;/* for safety */
331331
332- scan -> indexRelation -> rd_amroutine -> amrescan (scan ,keys ,nkeys ,
333- orderbys ,norderbys );
332+ scan -> indexRelation -> rd_indam -> amrescan (scan ,keys ,nkeys ,
333+ orderbys ,norderbys );
334334}
335335
336336/* ----------------
@@ -351,7 +351,7 @@ index_endscan(IndexScanDesc scan)
351351}
352352
353353/* End the AM's scan */
354- scan -> indexRelation -> rd_amroutine -> amendscan (scan );
354+ scan -> indexRelation -> rd_indam -> amendscan (scan );
355355
356356/* Release index refcount acquired by index_beginscan */
357357RelationDecrementReferenceCount (scan -> indexRelation );
@@ -373,7 +373,7 @@ index_markpos(IndexScanDesc scan)
373373SCAN_CHECKS ;
374374CHECK_SCAN_PROCEDURE (ammarkpos );
375375
376- scan -> indexRelation -> rd_amroutine -> ammarkpos (scan );
376+ scan -> indexRelation -> rd_indam -> ammarkpos (scan );
377377}
378378
379379/* ----------------
@@ -404,7 +404,7 @@ index_restrpos(IndexScanDesc scan)
404404
405405scan -> kill_prior_tuple = false;/* for safety */
406406
407- scan -> indexRelation -> rd_amroutine -> amrestrpos (scan );
407+ scan -> indexRelation -> rd_indam -> amrestrpos (scan );
408408}
409409
410410/*
@@ -430,9 +430,9 @@ index_parallelscan_estimate(Relation indexRelation, Snapshot snapshot)
430430 * AM-specific data needed. (It's hard to believe that could work, but
431431 * it's easy enough to cater to it here.)
432432 */
433- if (indexRelation -> rd_amroutine -> amestimateparallelscan != NULL )
433+ if (indexRelation -> rd_indam -> amestimateparallelscan != NULL )
434434nbytes = add_size (nbytes ,
435- indexRelation -> rd_amroutine -> amestimateparallelscan ());
435+ indexRelation -> rd_indam -> amestimateparallelscan ());
436436
437437return nbytes ;
438438}
@@ -465,12 +465,12 @@ index_parallelscan_initialize(Relation heapRelation, Relation indexRelation,
465465SerializeSnapshot (snapshot ,target -> ps_snapshot_data );
466466
467467/* aminitparallelscan is optional; assume no-op if not provided by AM */
468- if (indexRelation -> rd_amroutine -> aminitparallelscan != NULL )
468+ if (indexRelation -> rd_indam -> aminitparallelscan != NULL )
469469{
470470void * amtarget ;
471471
472472amtarget = OffsetToPointer (target ,offset );
473- indexRelation -> rd_amroutine -> aminitparallelscan (amtarget );
473+ indexRelation -> rd_indam -> aminitparallelscan (amtarget );
474474}
475475}
476476
@@ -484,8 +484,8 @@ index_parallelrescan(IndexScanDesc scan)
484484SCAN_CHECKS ;
485485
486486/* amparallelrescan is optional; assume no-op if not provided by AM */
487- if (scan -> indexRelation -> rd_amroutine -> amparallelrescan != NULL )
488- scan -> indexRelation -> rd_amroutine -> amparallelrescan (scan );
487+ if (scan -> indexRelation -> rd_indam -> amparallelrescan != NULL )
488+ scan -> indexRelation -> rd_indam -> amparallelrescan (scan );
489489}
490490
491491/*
@@ -539,7 +539,7 @@ index_getnext_tid(IndexScanDesc scan, ScanDirection direction)
539539 * scan->xs_recheck and possibly scan->xs_itup/scan->xs_hitup, though we
540540 * pay no attention to those fields here.
541541 */
542- found = scan -> indexRelation -> rd_amroutine -> amgettuple (scan ,direction );
542+ found = scan -> indexRelation -> rd_indam -> amgettuple (scan ,direction );
543543
544544/* Reset kill flag immediately for safety */
545545scan -> kill_prior_tuple = false;
@@ -724,7 +724,7 @@ index_getbitmap(IndexScanDesc scan, TIDBitmap *bitmap)
724724/*
725725 * have the am's getbitmap proc do all the work.
726726 */
727- ntids = scan -> indexRelation -> rd_amroutine -> amgetbitmap (scan ,bitmap );
727+ ntids = scan -> indexRelation -> rd_indam -> amgetbitmap (scan ,bitmap );
728728
729729pgstat_count_index_tuples (scan -> indexRelation ,ntids );
730730
@@ -751,8 +751,8 @@ index_bulk_delete(IndexVacuumInfo *info,
751751RELATION_CHECKS ;
752752CHECK_REL_PROCEDURE (ambulkdelete );
753753
754- return indexRelation -> rd_amroutine -> ambulkdelete (info ,stats ,
755- callback ,callback_state );
754+ return indexRelation -> rd_indam -> ambulkdelete (info ,stats ,
755+ callback ,callback_state );
756756}
757757
758758/* ----------------
@@ -770,7 +770,7 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
770770RELATION_CHECKS ;
771771CHECK_REL_PROCEDURE (amvacuumcleanup );
772772
773- return indexRelation -> rd_amroutine -> amvacuumcleanup (info ,stats );
773+ return indexRelation -> rd_indam -> amvacuumcleanup (info ,stats );
774774}
775775
776776/* ----------------
@@ -786,10 +786,10 @@ index_can_return(Relation indexRelation, int attno)
786786RELATION_CHECKS ;
787787
788788/* amcanreturn is optional; assume false if not provided by AM */
789- if (indexRelation -> rd_amroutine -> amcanreturn == NULL )
789+ if (indexRelation -> rd_indam -> amcanreturn == NULL )
790790return false;
791791
792- return indexRelation -> rd_amroutine -> amcanreturn (indexRelation ,attno );
792+ return indexRelation -> rd_indam -> amcanreturn (indexRelation ,attno );
793793}
794794
795795/* ----------------
@@ -827,7 +827,7 @@ index_getprocid(Relation irel,
827827int nproc ;
828828int procindex ;
829829
830- nproc = irel -> rd_amroutine -> amsupport ;
830+ nproc = irel -> rd_indam -> amsupport ;
831831
832832Assert (procnum > 0 && procnum <= (uint16 )nproc );
833833
@@ -861,7 +861,7 @@ index_getprocinfo(Relation irel,
861861int nproc ;
862862int procindex ;
863863
864- nproc = irel -> rd_amroutine -> amsupport ;
864+ nproc = irel -> rd_indam -> amsupport ;
865865
866866Assert (procnum > 0 && procnum <= (uint16 )nproc );
867867