Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e4cc42c

Browse files
committed
Port for PG14
1 parent 51e66b5 commit e4cc42c

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

lsm3.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,12 @@ lsm3_truncate_index(Oid index_oid, Oid heap_oid)
213213
table_close(heap, AccessShareLock);
214214
}
215215

216+
#if PG_VERSION_NUM>=140000
217+
#define INSERT_FLAGS UNIQUE_CHECK_NO, false
218+
#else
219+
#define INSERT_FLAGS false
220+
#endif
221+
216222
/* Merge top index into base index */
217223
static void
218224
lsm3_merge_indexes(Oid dst_oid, Oid src_oid, Oid heap_oid)
@@ -247,14 +253,14 @@ lsm3_merge_indexes(Oid dst_oid, Oid src_oid, Oid heap_oid)
247253
unsigned short save_info = itup->t_info;
248254
itup->t_info = (save_info & ~(INDEX_SIZE_MASK | INDEX_ALT_TID_MASK)) + BTreeTupleGetPostingOffset(itup);
249255
itup->t_tid = scan->xs_heaptid;
250-
_bt_doinsert(base_index, itup, false, heap); /* lsm3 index is not unique so need not to heck for duplica
256+
_bt_doinsert(base_index, itup, INSERT_FLAGS, heap); /* lsm3 index is not unique so need not to heck for duplica
251257
tes */
252258
itup->t_tid = save_tid;
253259
itup->t_info = save_info;
254260
}
255261
else
256262
{
257-
_bt_doinsert(base_index, itup, false, heap); /* lsm3 index is not unique so need not to heck for duplica
263+
_bt_doinsert(base_index, itup, INSERT_FLAGS, heap); /* lsm3 index is not unique so need not to heck for duplica
258264
tes */
259265
}
260266
}
@@ -435,6 +441,9 @@ static bool
435441
lsm3_insert(Relation rel, Datum *values, bool *isnull,
436442
ItemPointer ht_ctid, Relation heapRel,
437443
IndexUniqueCheck checkUnique,
444+
#if PG_VERSION_NUM>=140000
445+
bool indexUnchanged,
446+
#endif
438447
IndexInfo *indexInfo)
439448
{
440449
Lsm3DictEntry* entry = lsm3_get_entry(rel);
@@ -457,7 +466,11 @@ lsm3_insert(Relation rel, Datum *values, bool *isnull,
457466
index = index_open(entry->top[active_index], RowExclusiveLock);
458467
index->rd_rel->relam = BTREE_AM_OID;
459468
save_am = index->rd_rel->relam;
460-
btinsert(index, values, isnull, ht_ctid, heapRel, checkUnique, indexInfo);
469+
btinsert(index, values, isnull, ht_ctid, heapRel, checkUnique,
470+
#if PG_VERSION_NUM>=140000
471+
indexUnchanged,
472+
#endif
473+
indexInfo);
461474
index_close(index, RowExclusiveLock);
462475
index->rd_rel->relam = save_am;
463476

@@ -755,6 +768,9 @@ static bool
755768
lsm3_dummy_insert(Relation rel, Datum *values, bool *isnull,
756769
ItemPointer ht_ctid, Relation heapRel,
757770
IndexUniqueCheck checkUnique,
771+
#if PG_VERSION_NUM>=140000
772+
bool indexUnchanged,
773+
#endif
758774
IndexInfo *indexInfo)
759775
{
760776
return false;

0 commit comments

Comments
 (0)