@@ -222,7 +222,11 @@ writetup_rum_internal(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup
222
222
(void * ) & writtenlen , sizeof (writtenlen ));
223
223
LogicalTapeWrite (TAPE (state , LT_ARG ),
224
224
(void * ) item , size );
225
- if (state -> randomAccess ) /* need trailing length word? */
225
+ #if PG_VERSION_NUM >= 150000
226
+ if (state -> sortopt & TUPLESORT_RANDOMACCESS ) /* need trailing length word? */
227
+ #else
228
+ if (state -> randomAccess ) /* need trailing length word? */
229
+ #endif
226
230
LogicalTapeWrite (TAPE (state , LT_ARG ),
227
231
(void * ) & writtenlen , sizeof (writtenlen ));
228
232
}
@@ -260,11 +264,11 @@ readtup_rum_internal(RumTuplesortstate * state, SortTuple *stup,
260
264
261
265
if (!is_item )
262
266
stup -> datum1 = Float8GetDatum (state -> nKeys > 0 ? ((RumSortItem * ) item )-> data [0 ] : 0 );
263
-
264
- if (state -> randomAccess ) /* need trailing length word? */
265
267
#if PG_VERSION_NUM >= 150000
268
+ if (state -> sortopt & TUPLESORT_RANDOMACCESS ) /* need trailing length word? */
266
269
LogicalTapeReadExact (LT_ARG , & tuplen , sizeof (tuplen ));
267
270
#else
271
+ if (state -> randomAccess )
268
272
LogicalTapeReadExact (state -> tapeset , LT_ARG , & tuplen , sizeof (tuplen ));
269
273
#endif
270
274
}
@@ -291,7 +295,14 @@ RumTuplesortstate *
291
295
rum_tuplesort_begin_rum (int workMem , int nKeys , bool randomAccess ,
292
296
bool compareItemPointer )
293
297
{
298
+ #if PG_VERSION_NUM >= 150000
299
+ RumTuplesortstate * state = tuplesort_begin_common (workMem ,
300
+ randomAccess ?
301
+ TUPLESORT_RANDOMACCESS :
302
+ TUPLESORT_NONE );
303
+ #else
294
304
RumTuplesortstate * state = tuplesort_begin_common (workMem , randomAccess );
305
+ #endif
295
306
MemoryContext oldcontext ;
296
307
297
308
oldcontext = MemoryContextSwitchTo (state -> sortcontext );
0 commit comments