Skip to content

Commit e8789f1

Browse files
author
Arseny Kositsyn
committed
[PGPRO-12159] Fixed test crashes on version 15 of PostgreSQL.
The crashes were due to the fact that the construct_array_builtin() function is not defined on versions below 16. Tags: rum
1 parent 5bba086 commit e8789f1

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/rum_debug_funcs.c

+36-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,13 @@ rum_page_opaque_info(PG_FUNCTION_ARGS)
316316
values[1] = Int64GetDatum(opaq->rightlink);
317317
values[2] = Int32GetDatum(opaq->maxoff);
318318
values[3] = Int32GetDatum(opaq->freespace);
319-
values[4] = PointerGetDatum(construct_array_builtin(flags, nflags, TEXTOID));
319+
320+
#if PG_VERSION_NUM >= 160000
321+
values[4] = ItemPointerGetDatum(construct_array_builtin(flags, nflags, TEXTOID));
322+
#else
323+
values[4] = PointerGetDatum(construct_array(flags, nflags,
324+
TEXTOID, -1, false, TYPALIGN_INT));
325+
#endif
320326

321327
/* Build and return the result tuple. */
322328
resultTuple = heap_form_tuple(tupdesc, values, nulls);
@@ -495,7 +501,13 @@ rum_leaf_data_page_items(PG_FUNCTION_ARGS)
495501
{
496502
high_key_ptr = RumDataPageGetRightBound(inter_call_data->page);
497503
values[0] = BoolGetDatum(true);
504+
505+
#if PG_VERSION_NUM >= 160000
498506
values[1] = ItemPointerGetDatum(&(high_key_ptr->iptr));
507+
#else
508+
values[1] = PointerGetDatum(&(high_key_ptr->iptr));
509+
#endif
510+
499511
values[2] = BoolGetDatum(high_key_ptr->addInfoIsNull);
500512

501513
/* Returning add info */
@@ -533,7 +545,13 @@ rum_leaf_data_page_items(PG_FUNCTION_ARGS)
533545

534546
/* Writing data from rum_item to values */
535547
values[0] = false;
548+
549+
#if PG_VERSION_NUM >= 160000
536550
values[1] = ItemPointerGetDatum(&(rum_item_ptr->iptr));
551+
#else
552+
values[1] = PointerGetDatum(&(rum_item_ptr->iptr));
553+
#endif
554+
537555
values[2] = BoolGetDatum(rum_item_ptr->addInfoIsNull);
538556

539557
/* Returning add info */
@@ -733,7 +751,13 @@ rum_internal_data_page_items(PG_FUNCTION_ARGS)
733751
high_key_ptr = RumDataPageGetRightBound(inter_call_data->page);
734752
values[0] = BoolGetDatum(true);
735753
nulls[1] = true;
754+
755+
#if PG_VERSION_NUM >= 160000
736756
values[2] = ItemPointerGetDatum(&(high_key_ptr->iptr));
757+
#else
758+
values[2] = PointerGetDatum(&(high_key_ptr->iptr));
759+
#endif
760+
737761
values[3] = BoolGetDatum(high_key_ptr->addInfoIsNull);
738762

739763
/* Returning add info */
@@ -771,7 +795,13 @@ rum_internal_data_page_items(PG_FUNCTION_ARGS)
771795
/* Writing data from posting_item_ptr to values */
772796
values[0] = BoolGetDatum(false);
773797
values[1] = UInt32GetDatum(PostingItemGetBlockNumber(posting_item_ptr));
798+
799+
#if PG_VERSION_NUM >= 160000
774800
values[2] = ItemPointerGetDatum(&(posting_item_ptr->item.iptr));
801+
#else
802+
values[2] = PointerGetDatum(&(posting_item_ptr->item.iptr));
803+
#endif
804+
775805
values[3] = BoolGetDatum(posting_item_ptr->item.addInfoIsNull);
776806

777807
/* Returning add info */
@@ -1049,7 +1079,12 @@ rum_leaf_entry_page_items(PG_FUNCTION_ARGS)
10491079
values[2] = category_get_datum_text(inter_call_data->cur_tuple_key_category);
10501080

10511081
/* Writing data from rum_item to values */
1082+
#if PG_VERSION_NUM >= 160000
10521083
values[3] = ItemPointerGetDatum(&(rum_item_ptr->iptr));
1084+
#else
1085+
values[3] = PointerGetDatum(&(rum_item_ptr->iptr));
1086+
#endif
1087+
10531088
values[4] = BoolGetDatum(rum_item_ptr->addInfoIsNull);
10541089

10551090
/* Returning add info */

0 commit comments

Comments
 (0)