mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-19 12:13:24 +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, \
|
multixact_freeze_table_age, \
|
||||||
oldestXmin, \
|
oldestXmin, \
|
||||||
freezeLimit, \
|
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
|
||||||
|
|
||||||
#endif /* TIMESCALEDB_COMPAT_H */
|
#endif /* TIMESCALEDB_COMPAT_H */
|
||||||
|
@ -1689,13 +1689,17 @@ ExecInsert(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, TupleTableSl
|
|||||||
if (mtstate->operation == CMD_UPDATE && mtstate->mt_transition_capture &&
|
if (mtstate->operation == CMD_UPDATE && mtstate->mt_transition_capture &&
|
||||||
mtstate->mt_transition_capture->tcs_update_new_table)
|
mtstate->mt_transition_capture->tcs_update_new_table)
|
||||||
{
|
{
|
||||||
ExecARUpdateTriggers(estate,
|
ExecARUpdateTriggersCompat(estate,
|
||||||
resultRelInfo,
|
resultRelInfo,
|
||||||
NULL,
|
NULL, /* src_partinfo */
|
||||||
NULL,
|
NULL, /* dst_partinfo */
|
||||||
slot,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
mtstate->mt_transition_capture);
|
slot,
|
||||||
|
NULL,
|
||||||
|
mtstate->mt_transition_capture,
|
||||||
|
false /* is_crosspart_update */
|
||||||
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We've already captured the NEW TABLE row, so make sure any AR
|
* 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 */
|
/* BEFORE ROW UPDATE Triggers */
|
||||||
if (resultRelInfo->ri_TrigDesc && resultRelInfo->ri_TrigDesc->trig_update_before_row)
|
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" */
|
return NULL; /* "do nothing" */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2122,14 +2132,19 @@ ExecUpdate(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, ItemPointer
|
|||||||
(estate->es_processed)++;
|
(estate->es_processed)++;
|
||||||
|
|
||||||
/* AFTER ROW UPDATE Triggers */
|
/* AFTER ROW UPDATE Triggers */
|
||||||
ExecARUpdateTriggers(estate,
|
ExecARUpdateTriggersCompat(estate,
|
||||||
resultRelInfo,
|
resultRelInfo,
|
||||||
tupleid,
|
NULL,
|
||||||
oldtuple,
|
NULL,
|
||||||
slot,
|
tupleid,
|
||||||
recheckIndexes,
|
oldtuple,
|
||||||
mtstate->operation == CMD_INSERT ? mtstate->mt_oc_transition_capture :
|
slot,
|
||||||
mtstate->mt_transition_capture);
|
recheckIndexes,
|
||||||
|
mtstate->operation == CMD_INSERT ?
|
||||||
|
mtstate->mt_oc_transition_capture :
|
||||||
|
mtstate->mt_transition_capture,
|
||||||
|
false /* is_crosspart_update */
|
||||||
|
);
|
||||||
|
|
||||||
list_free(recheckIndexes);
|
list_free(recheckIndexes);
|
||||||
|
|
||||||
@ -2729,13 +2744,16 @@ ExecDelete(ModifyTableState *mtstate, ResultRelInfo *resultRelInfo, ItemPointer
|
|||||||
if (mtstate->operation == CMD_UPDATE && mtstate->mt_transition_capture &&
|
if (mtstate->operation == CMD_UPDATE && mtstate->mt_transition_capture &&
|
||||||
mtstate->mt_transition_capture->tcs_update_old_table)
|
mtstate->mt_transition_capture->tcs_update_old_table)
|
||||||
{
|
{
|
||||||
ExecARUpdateTriggers(estate,
|
ExecARUpdateTriggersCompat(estate,
|
||||||
resultRelInfo,
|
resultRelInfo,
|
||||||
tupleid,
|
NULL,
|
||||||
oldtuple,
|
NULL,
|
||||||
NULL,
|
tupleid,
|
||||||
NULL,
|
oldtuple,
|
||||||
mtstate->mt_transition_capture);
|
NULL,
|
||||||
|
NULL,
|
||||||
|
mtstate->mt_transition_capture,
|
||||||
|
false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We've already captured the NEW TABLE row, so make sure any AR
|
* 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 */
|
/* 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 */
|
/* Process RETURNING if present and if requested */
|
||||||
if (processReturning && resultRelInfo->ri_projectReturning)
|
if (processReturning && resultRelInfo->ri_projectReturning)
|
||||||
|
@ -1284,6 +1284,10 @@ chunk_update_relstats(Chunk *chunk, int32 num_pages, float num_tuples, int32 num
|
|||||||
true,
|
true,
|
||||||
InvalidTransactionId,
|
InvalidTransactionId,
|
||||||
InvalidMultiXactId,
|
InvalidMultiXactId,
|
||||||
|
#if PG15_GE
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
#endif
|
||||||
false);
|
false);
|
||||||
|
|
||||||
relation_close(rel, ShareUpdateExclusiveLock);
|
relation_close(rel, ShareUpdateExclusiveLock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user