mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-23 14:39:15 +08:00
PG16: ExecInsertIndexTuples requires additional parameter
PG16 adds a new boolean parameter to the ExecInsertIndexTuples function to denote if the index is a BRIN index, which is then used to determine if the index update can be skipped. The fix also removes the INDEX_ATTR_BITMAP_ALL enum value. Adapt these changes by updating the compat function to accomodate the new parameter added to the ExecInsertIndexTuples function and using an alternative for the removed INDEX_ATTR_BITMAP_ALL enum value. postgres/postgres@19d8e23
This commit is contained in:
parent
8a2b6a03e0
commit
3af0d282ea
@ -89,8 +89,19 @@
|
|||||||
update, \
|
update, \
|
||||||
noDupErr, \
|
noDupErr, \
|
||||||
specConflict, \
|
specConflict, \
|
||||||
arbiterIndexes) \
|
arbiterIndexes, \
|
||||||
|
onlySummarizing) \
|
||||||
ExecInsertIndexTuples(slot, estate, noDupErr, specConflict, arbiterIndexes)
|
ExecInsertIndexTuples(slot, estate, noDupErr, specConflict, arbiterIndexes)
|
||||||
|
#elif PG16_LT
|
||||||
|
#define ExecInsertIndexTuplesCompat(rri, \
|
||||||
|
slot, \
|
||||||
|
estate, \
|
||||||
|
update, \
|
||||||
|
noDupErr, \
|
||||||
|
specConflict, \
|
||||||
|
arbiterIndexes, \
|
||||||
|
onlySummarizing) \
|
||||||
|
ExecInsertIndexTuples(rri, slot, estate, update, noDupErr, specConflict, arbiterIndexes)
|
||||||
#else
|
#else
|
||||||
#define ExecInsertIndexTuplesCompat(rri, \
|
#define ExecInsertIndexTuplesCompat(rri, \
|
||||||
slot, \
|
slot, \
|
||||||
@ -98,8 +109,16 @@
|
|||||||
update, \
|
update, \
|
||||||
noDupErr, \
|
noDupErr, \
|
||||||
specConflict, \
|
specConflict, \
|
||||||
arbiterIndexes) \
|
arbiterIndexes, \
|
||||||
ExecInsertIndexTuples(rri, slot, estate, update, noDupErr, specConflict, arbiterIndexes)
|
onlySummarizing) \
|
||||||
|
ExecInsertIndexTuples(rri, \
|
||||||
|
slot, \
|
||||||
|
estate, \
|
||||||
|
update, \
|
||||||
|
noDupErr, \
|
||||||
|
specConflict, \
|
||||||
|
arbiterIndexes, \
|
||||||
|
onlySummarizing)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* PG14 fixes a bug in miscomputation of relids set in pull_varnos. The bugfix
|
/* PG14 fixes a bug in miscomputation of relids set in pull_varnos. The bugfix
|
||||||
|
@ -385,7 +385,8 @@ TSCopyMultiInsertBufferFlush(TSCopyMultiInsertInfo *miinfo, TSCopyMultiInsertBuf
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
NULL,
|
NULL,
|
||||||
NIL);
|
NIL,
|
||||||
|
false);
|
||||||
|
|
||||||
ExecARInsertTriggers(estate,
|
ExecARInsertTriggers(estate,
|
||||||
resultRelInfo,
|
resultRelInfo,
|
||||||
@ -1091,7 +1092,8 @@ copyfrom(CopyChunkState *ccstate, List *range_table, Hypertable *ht, MemoryConte
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
NULL,
|
NULL,
|
||||||
NIL);
|
NIL,
|
||||||
|
false);
|
||||||
/* AFTER ROW INSERT Triggers */
|
/* AFTER ROW INSERT Triggers */
|
||||||
ExecARInsertTriggers(estate,
|
ExecARInsertTriggers(estate,
|
||||||
resultRelInfo,
|
resultRelInfo,
|
||||||
|
@ -193,9 +193,16 @@ ht_ExecUpdateEpilogue(ModifyTableContext * context, UpdateContext * updateCxt,
|
|||||||
ModifyTableState *mtstate = context->mtstate;
|
ModifyTableState *mtstate = context->mtstate;
|
||||||
|
|
||||||
/* insert index entries for tuple if necessary */
|
/* insert index entries for tuple if necessary */
|
||||||
|
|
||||||
if (resultRelInfo->ri_NumIndices > 0 && updateCxt->updateIndexes)
|
if (resultRelInfo->ri_NumIndices > 0 && updateCxt->updateIndexes)
|
||||||
recheckIndexes =
|
recheckIndexes = ExecInsertIndexTuplesCompat(resultRelInfo,
|
||||||
ExecInsertIndexTuples(resultRelInfo, slot, context->estate, true, false, NULL, NIL);
|
slot,
|
||||||
|
context->estate,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
NULL,
|
||||||
|
NIL,
|
||||||
|
false);
|
||||||
|
|
||||||
/* AFTER ROW UPDATE Triggers */
|
/* AFTER ROW UPDATE Triggers */
|
||||||
ExecARUpdateTriggersCompat(context->estate,
|
ExecARUpdateTriggersCompat(context->estate,
|
||||||
|
@ -1790,13 +1790,14 @@ ExecInsert(ModifyTableContext *context, ResultRelInfo *resultRelInfo, TupleTable
|
|||||||
specToken);
|
specToken);
|
||||||
|
|
||||||
/* insert index entries for tuple */
|
/* insert index entries for tuple */
|
||||||
recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
|
recheckIndexes = ExecInsertIndexTuplesCompat(resultRelInfo,
|
||||||
slot,
|
slot,
|
||||||
estate,
|
estate,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
&specConflict,
|
&specConflict,
|
||||||
arbiterIndexes);
|
arbiterIndexes,
|
||||||
|
false);
|
||||||
|
|
||||||
/* adjust the tuple's state accordingly */
|
/* adjust the tuple's state accordingly */
|
||||||
table_tuple_complete_speculative(resultRelationDesc, slot, specToken, !specConflict);
|
table_tuple_complete_speculative(resultRelationDesc, slot, specToken, !specConflict);
|
||||||
@ -1830,8 +1831,14 @@ ExecInsert(ModifyTableContext *context, ResultRelInfo *resultRelInfo, TupleTable
|
|||||||
|
|
||||||
/* insert index entries for tuple */
|
/* insert index entries for tuple */
|
||||||
if (resultRelInfo->ri_NumIndices > 0)
|
if (resultRelInfo->ri_NumIndices > 0)
|
||||||
recheckIndexes =
|
recheckIndexes = ExecInsertIndexTuplesCompat(resultRelInfo,
|
||||||
ExecInsertIndexTuples(resultRelInfo, slot, estate, false, false, NULL, NIL);
|
slot,
|
||||||
|
estate,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
NULL,
|
||||||
|
NIL,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2443,7 +2443,15 @@ fix_index_qual(Relation comp_chunk_rel, Relation index_rel, Var *var, List **pre
|
|||||||
char *column_name, Node *node, Oid opno)
|
char *column_name, Node *node, Oid opno)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
#if PG16_LT
|
||||||
Bitmapset *key_columns = RelationGetIndexAttrBitmap(comp_chunk_rel, INDEX_ATTR_BITMAP_ALL);
|
Bitmapset *key_columns = RelationGetIndexAttrBitmap(comp_chunk_rel, INDEX_ATTR_BITMAP_ALL);
|
||||||
|
#else
|
||||||
|
Bitmapset *key_columns =
|
||||||
|
RelationGetIndexAttrBitmap(comp_chunk_rel, INDEX_ATTR_BITMAP_HOT_BLOCKING);
|
||||||
|
key_columns =
|
||||||
|
bms_add_members(key_columns,
|
||||||
|
RelationGetIndexAttrBitmap(comp_chunk_rel, INDEX_ATTR_BITMAP_SUMMARIZED));
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < index_rel->rd_index->indnatts; i++)
|
for (i = 0; i < index_rel->rd_index->indnatts; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user