mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-19 04:03:06 +08:00
Add compat macros for PG15 signature changes
PG15 refactors INSERT/UPDATE/DELETE code and changes the signatures of some of the functions. https://github.com/postgres/postgres/commit/25e777cf
This commit is contained in:
parent
9eef2e70f2
commit
fe8d823bef
@ -624,7 +624,92 @@ pg_strtoint64(const char *str)
|
||||
multixact_freeze_table_age, \
|
||||
oldestXmin, \
|
||||
freezeLimit, \
|
||||
multiXactCutoff)
|
||||
multiXactCutoff, \
|
||||
NULL)
|
||||
#endif
|
||||
|
||||
#if PG15_LT
|
||||
#define ExecARUpdateTriggersCompat(estate, \
|
||||
resultRelInfo, \
|
||||
src_partinfo, \
|
||||
dst_partinfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
inewslot, \
|
||||
recheckIndexes, \
|
||||
transtition_capture, \
|
||||
is_crosspart_update) \
|
||||
ExecARUpdateTriggers(estate, \
|
||||
resultRelInfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
inewslot, \
|
||||
recheckIndexes, \
|
||||
transtition_capture)
|
||||
#else
|
||||
#define ExecARUpdateTriggersCompat(estate, \
|
||||
resultRelInfo, \
|
||||
src_partinfo, \
|
||||
dst_partinfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
inewslot, \
|
||||
recheckIndexes, \
|
||||
transtition_capture, \
|
||||
is_crosspart_update) \
|
||||
ExecARUpdateTriggers(estate, \
|
||||
resultRelInfo, \
|
||||
src_partinfo, \
|
||||
dst_partinfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
inewslot, \
|
||||
recheckIndexes, \
|
||||
transtition_capture, \
|
||||
is_crosspart_update)
|
||||
#endif
|
||||
|
||||
#if PG15_LT
|
||||
#define ExecBRUpdateTriggersCompat(estate, \
|
||||
epqstate, \
|
||||
resultRelInfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
slot, \
|
||||
tmfdp) \
|
||||
ExecBRUpdateTriggers(estate, epqstate, resultRelInfo, tupleid, oldtuple, slot)
|
||||
#else
|
||||
#define ExecBRUpdateTriggersCompat(estate, \
|
||||
epqstate, \
|
||||
resultRelInfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
slot, \
|
||||
tmfdp) \
|
||||
ExecBRUpdateTriggers(estate, epqstate, resultRelInfo, tupleid, oldtuple, slot, tmfdp)
|
||||
#endif
|
||||
|
||||
#if PG15_LT
|
||||
#define ExecARDeleteTriggersCompat(estate, \
|
||||
resultRelInfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
ar_delete_trig_tcs, \
|
||||
is_crosspart_update) \
|
||||
ExecARDeleteTriggers(estate, resultRelInfo, tupleid, oldtuple, ar_delete_trig_tcs)
|
||||
#else
|
||||
#define ExecARDeleteTriggersCompat(estate, \
|
||||
resultRelInfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
ar_delete_trig_tcs, \
|
||||
is_crosspart_update) \
|
||||
ExecARDeleteTriggers(estate, \
|
||||
resultRelInfo, \
|
||||
tupleid, \
|
||||
oldtuple, \
|
||||
ar_delete_trig_tcs, \
|
||||
is_crosspart_update)
|
||||
#endif
|
||||
|
||||
#endif /* TIMESCALEDB_COMPAT_H */
|
||||
|
@ -1689,13 +1689,17 @@ ExecInsert(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, TupleTableSl
|
||||
if (mtstate->operation == CMD_UPDATE && mtstate->mt_transition_capture &&
|
||||
mtstate->mt_transition_capture->tcs_update_new_table)
|
||||
{
|
||||
ExecARUpdateTriggers(estate,
|
||||
resultRelInfo,
|
||||
NULL,
|
||||
NULL,
|
||||
slot,
|
||||
NULL,
|
||||
mtstate->mt_transition_capture);
|
||||
ExecARUpdateTriggersCompat(estate,
|
||||
resultRelInfo,
|
||||
NULL, /* src_partinfo */
|
||||
NULL, /* dst_partinfo */
|
||||
NULL,
|
||||
NULL,
|
||||
slot,
|
||||
NULL,
|
||||
mtstate->mt_transition_capture,
|
||||
false /* is_crosspart_update */
|
||||
);
|
||||
|
||||
/*
|
||||
* We've already captured the NEW TABLE row, so make sure any AR
|
||||
@ -1836,7 +1840,13 @@ ExecUpdate(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, ItemPointer
|
||||
/* BEFORE ROW UPDATE Triggers */
|
||||
if (resultRelInfo->ri_TrigDesc && resultRelInfo->ri_TrigDesc->trig_update_before_row)
|
||||
{
|
||||
if (!ExecBRUpdateTriggers(estate, epqstate, resultRelInfo, tupleid, oldtuple, slot))
|
||||
if (!ExecBRUpdateTriggersCompat(estate,
|
||||
epqstate,
|
||||
resultRelInfo,
|
||||
tupleid,
|
||||
oldtuple,
|
||||
slot,
|
||||
NULL))
|
||||
return NULL; /* "do nothing" */
|
||||
}
|
||||
|
||||
@ -2122,14 +2132,19 @@ ExecUpdate(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, ItemPointer
|
||||
(estate->es_processed)++;
|
||||
|
||||
/* AFTER ROW UPDATE Triggers */
|
||||
ExecARUpdateTriggers(estate,
|
||||
resultRelInfo,
|
||||
tupleid,
|
||||
oldtuple,
|
||||
slot,
|
||||
recheckIndexes,
|
||||
mtstate->operation == CMD_INSERT ? mtstate->mt_oc_transition_capture :
|
||||
mtstate->mt_transition_capture);
|
||||
ExecARUpdateTriggersCompat(estate,
|
||||
resultRelInfo,
|
||||
NULL,
|
||||
NULL,
|
||||
tupleid,
|
||||
oldtuple,
|
||||
slot,
|
||||
recheckIndexes,
|
||||
mtstate->operation == CMD_INSERT ?
|
||||
mtstate->mt_oc_transition_capture :
|
||||
mtstate->mt_transition_capture,
|
||||
false /* is_crosspart_update */
|
||||
);
|
||||
|
||||
list_free(recheckIndexes);
|
||||
|
||||
@ -2729,13 +2744,16 @@ ExecDelete(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, ItemPointer
|
||||
if (mtstate->operation == CMD_UPDATE && mtstate->mt_transition_capture &&
|
||||
mtstate->mt_transition_capture->tcs_update_old_table)
|
||||
{
|
||||
ExecARUpdateTriggers(estate,
|
||||
resultRelInfo,
|
||||
tupleid,
|
||||
oldtuple,
|
||||
NULL,
|
||||
NULL,
|
||||
mtstate->mt_transition_capture);
|
||||
ExecARUpdateTriggersCompat(estate,
|
||||
resultRelInfo,
|
||||
NULL,
|
||||
NULL,
|
||||
tupleid,
|
||||
oldtuple,
|
||||
NULL,
|
||||
NULL,
|
||||
mtstate->mt_transition_capture,
|
||||
false);
|
||||
|
||||
/*
|
||||
* We've already captured the NEW TABLE row, so make sure any AR
|
||||
@ -2745,7 +2763,7 @@ ExecDelete(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, ItemPointer
|
||||
}
|
||||
|
||||
/* AFTER ROW DELETE Triggers */
|
||||
ExecARDeleteTriggers(estate, resultRelInfo, tupleid, oldtuple, ar_delete_trig_tcs);
|
||||
ExecARDeleteTriggersCompat(estate, resultRelInfo, tupleid, oldtuple, ar_delete_trig_tcs, false);
|
||||
|
||||
/* Process RETURNING if present and if requested */
|
||||
if (processReturning && resultRelInfo->ri_projectReturning)
|
||||
|
@ -1284,6 +1284,10 @@ chunk_update_relstats(Chunk *chunk, int32 num_pages, float num_tuples, int32 num
|
||||
true,
|
||||
InvalidTransactionId,
|
||||
InvalidMultiXactId,
|
||||
#if PG15_GE
|
||||
NULL,
|
||||
NULL,
|
||||
#endif
|
||||
false);
|
||||
|
||||
relation_close(rel, ShareUpdateExclusiveLock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user