add searchFuncHook

This commit is contained in:
ganyang
2022-11-17 15:23:17 +08:00
parent 6e6fb41951
commit 7b56472d8e
2 changed files with 11 additions and 0 deletions

View File

@ -1279,6 +1279,8 @@ typedef struct opclasscacheent {
RegProcedure* supportProcs; /* OIDs of support procedures */
} OpClassCacheEnt;
typedef PGFunction (*searchFunc)(Oid funcId);
/* non-export function prototypes */
static void RelationFlushRelation(Relation relation);
@ -5635,8 +5637,16 @@ static void AttrAutoIncrementFetch(Relation relation, AttrNumber attnum, char* a
castfunc = (const FmgrBuiltin*)SearchBuiltinFuncByOid(autoinc->autoincin_funcid);
cons_autoinc->datum2autoinc_func = castfunc ? (void*)(uintptr_t)castfunc->func : NULL;
if (cons_autoinc->datum2autoinc_func == NULL && u_sess->hook_cxt.searchFuncHook != NULL) {
PGFunction castFunc2 = ((searchFunc)(u_sess->hook_cxt.searchFuncHook))(autoinc->autoincin_funcid);
cons_autoinc->datum2autoinc_func = castFunc2 ? (void*)(uintptr_t)castFunc2 : NULL;
}
castfunc = (const FmgrBuiltin*)SearchBuiltinFuncByOid(autoinc->autoincout_funcid);
cons_autoinc->autoinc2datum_func = castfunc ? (void*)(uintptr_t)castfunc->func : NULL;
if (cons_autoinc->autoinc2datum_func == NULL && u_sess->hook_cxt.searchFuncHook != NULL) {
PGFunction castFunc2 = ((searchFunc)(u_sess->hook_cxt.searchFuncHook))(autoinc->autoincout_funcid);
cons_autoinc->autoinc2datum_func = castFunc2 ? (void*)(uintptr_t)castFunc2 : NULL;
}
relation->rd_att->constr->cons_autoinc = cons_autoinc;
}

View File

@ -2692,6 +2692,7 @@ typedef struct knl_u_hook_context {
void *aggSmpHook;
void *standardProcessUtilityHook;
void *aggIsSupportedHook;
void *searchFuncHook;
} knl_u_hook_context;
/* PBE message flag */
typedef enum {