Skip to content

Commit

Permalink
Restore GetIndexAmRoutine signature for compatibility with other callers
Browse files Browse the repository at this point in the history
Use GetIndexAmRoutineExtended instead for all Orioledb extensibility.
  • Loading branch information
pashkinelfe committed Oct 16, 2024
1 parent 7e50554 commit 3e6f16b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src/backend/access/index/amapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ GetIndexAmRoutineWithTableAM(Oid tamoid, Oid amhandler)
return routine;
}


/*
* GetIndexAmRoutine - call the specified access method handler routine to get
* its IndexAmRoutine struct, which will be palloc'd in the caller's context.
Expand All @@ -57,7 +56,13 @@ GetIndexAmRoutineWithTableAM(Oid tamoid, Oid amhandler)
* indexes for the system catalogs. relcache.c relies on that.
*/
IndexAmRoutine *
GetIndexAmRoutine(Oid indoid, Oid amhandler)
GetIndexAmRoutine(Oid amhandler)
{
return GetIndexAmRoutineExtended(InvalidOid, amhandler);
}

IndexAmRoutine *
GetIndexAmRoutineExtended(Oid indoid, Oid amhandler)
{
HeapTuple ht_idx;
HeapTuple ht_tblrel;
Expand Down Expand Up @@ -146,7 +151,7 @@ GetIndexAmRoutineByAmId(Oid indoid, Oid amoid, bool noerror)
ReleaseSysCache(tuple);

/* And finally, call the handler function to get the API struct. */
return GetIndexAmRoutine(indoid, amhandler);
return GetIndexAmRoutineExtended(indoid, amhandler);
}


Expand Down
2 changes: 1 addition & 1 deletion src/backend/commands/indexcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ CheckIndexCompatible(Oid oldId,
accessMethodName)));
accessMethodForm = (Form_pg_am) GETSTRUCT(tuple);
accessMethodId = accessMethodForm->oid;
amRoutine = GetIndexAmRoutine(oldId, accessMethodForm->amhandler);
amRoutine = GetIndexAmRoutineExtended(oldId, accessMethodForm->amhandler);
ReleaseSysCache(tuple);

amcanorder = amRoutine->amcanorder;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/adt/ruleutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
amrec = (Form_pg_am) GETSTRUCT(ht_am);

/* Fetch the index AM's API struct */
amroutine = GetIndexAmRoutine(indexrelid, amrec->amhandler);
amroutine = GetIndexAmRoutineExtended(indexrelid, amrec->amhandler);

/*
* Get the index expressions, if any. (NOTE: we do not use the relcache
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/cache/relcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ InitIndexAmRoutine(Relation relation)
* Call the amhandler in current, short-lived memory context, just in case
* it leaks anything (it probably won't, but let's be paranoid).
*/
tmp = GetIndexAmRoutine(relation->rd_id, relation->rd_amhandler);
tmp = GetIndexAmRoutineExtended(relation->rd_id, relation->rd_amhandler);

/* OK, now transfer the data into relation's rd_indexcxt. */
cached = (IndexAmRoutine *) MemoryContextAlloc(relation->rd_indexcxt,
Expand Down
3 changes: 2 additions & 1 deletion src/include/access/amapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ typedef struct IndexAmRoutine

/* Functions in access/index/amapi.c */
extern IndexAmRoutine *GetIndexAmRoutineWithTableAM(Oid tamoid, Oid amhandler);
extern IndexAmRoutine *GetIndexAmRoutine(Oid indoid, Oid amhandler);
extern IndexAmRoutine *GetIndexAmRoutine(Oid amhandler);
extern IndexAmRoutine *GetIndexAmRoutineExtended(Oid indoid, Oid amhandler);
extern IndexAmRoutine *GetIndexAmRoutineByAmId(Oid indoid, Oid amoid, bool noerror);

typedef IndexAmRoutine *(*IndexAMRoutineHookType) (Oid tamoid, Oid amhandler);
Expand Down

0 comments on commit 3e6f16b

Please sign in to comment.