@@ -162,6 +162,19 @@ bool optimize_bounded_sort = true;
162162#define LogicalTapeRewindForWrite (x , y ) LogicalTapeRewind((x), (y), true)
163163#endif
164164
165+ #if PG_VERSION_NUM >= 110000
166+ #define RUM_SORT_START (INT1 , INT2 , INT3 , INT4 , INT5 ) \
167+ TRACE_POSTGRESQL_SORT_START(INT1, INT2, INT3, INT4, INT5, false)
168+ #else
169+ #define RUM_SORT_START (INT1 , INT2 , INT3 , INT4 , INT5 ) \
170+ TRACE_POSTGRESQL_SORT_START(INT1, INT2, INT3, INT4, INT5)
171+ #endif
172+
173+ #if PG_VERSION_NUM >= 110000
174+ #define LogicalTapeSetCreate (X ) LogicalTapeSetCreate(X, NULL, NULL, 1)
175+ #define LogicalTapeFreeze (X , Y ) LogicalTapeFreeze(X, Y, NULL)
176+ #endif
177+
165178/*
166179 * The objects we actually sort are SortTuple structs. These contain
167180 * a pointer to the tuple proper (might be a MinimalTuple or IndexTuple),
@@ -963,11 +976,11 @@ rum_tuplesort_begin_heap(TupleDesc tupDesc,
963976
964977 state -> nKeys = nkeys ;
965978
966- TRACE_POSTGRESQL_SORT_START (HEAP_SORT ,
967- false, /* no unique check */
968- nkeys ,
969- workMem ,
970- randomAccess );
979+ RUM_SORT_START (HEAP_SORT ,
980+ false, /* no unique check */
981+ nkeys ,
982+ workMem ,
983+ randomAccess );
971984
972985 state -> comparetup = comparetup_heap ;
973986 state -> copytup = copytup_heap ;
@@ -1025,11 +1038,11 @@ rum_tuplesort_begin_cluster(TupleDesc tupDesc,
10251038
10261039 state -> nKeys = RelationGetNumberOfAttributes (indexRel );
10271040
1028- TRACE_POSTGRESQL_SORT_START (CLUSTER_SORT ,
1029- false, /* no unique check */
1030- state -> nKeys ,
1031- workMem ,
1032- randomAccess );
1041+ RUM_SORT_START (CLUSTER_SORT ,
1042+ false, /* no unique check */
1043+ state -> nKeys ,
1044+ workMem ,
1045+ randomAccess );
10331046
10341047 state -> comparetup = comparetup_cluster ;
10351048 state -> copytup = copytup_cluster ;
@@ -1085,11 +1098,11 @@ rum_tuplesort_begin_index_btree(Relation heapRel,
10851098
10861099 state -> nKeys = RelationGetNumberOfAttributes (indexRel );
10871100
1088- TRACE_POSTGRESQL_SORT_START (INDEX_SORT ,
1089- enforceUnique ,
1090- state -> nKeys ,
1091- workMem ,
1092- randomAccess );
1101+ RUM_SORT_START (INDEX_SORT ,
1102+ enforceUnique ,
1103+ state -> nKeys ,
1104+ workMem ,
1105+ randomAccess );
10931106
10941107 state -> comparetup = comparetup_index_btree ;
10951108 state -> copytup = copytup_index ;
@@ -1162,11 +1175,11 @@ rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess,
11621175
11631176 state -> nKeys = nKeys ;
11641177
1165- TRACE_POSTGRESQL_SORT_START (INDEX_SORT ,
1166- false, /* no unique check */
1167- state -> nKeys ,
1168- workMem ,
1169- randomAccess );
1178+ RUM_SORT_START (INDEX_SORT ,
1179+ false, /* no unique check */
1180+ state -> nKeys ,
1181+ workMem ,
1182+ randomAccess );
11701183
11711184 state -> comparetup = comparetup_rum ;
11721185 state -> copytup = copytup_rum ;
@@ -1195,11 +1208,11 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp)
11951208 "begin rumitem sort: workMem = %d" , workMem );
11961209#endif
11971210
1198- TRACE_POSTGRESQL_SORT_START (INDEX_SORT ,
1199- false, /* no unique check */
1200- 2 ,
1201- workMem ,
1202- false);
1211+ RUM_SORT_START (INDEX_SORT ,
1212+ false, /* no unique check */
1213+ 2 ,
1214+ workMem ,
1215+ false);
12031216
12041217 state -> cmp = cmp ;
12051218 state -> comparetup = comparetup_rumitem ;
@@ -1236,11 +1249,11 @@ rum_tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation,
12361249
12371250 state -> nKeys = 1 ; /* always a one-column sort */
12381251
1239- TRACE_POSTGRESQL_SORT_START (DATUM_SORT ,
1240- false, /* no unique check */
1241- 1 ,
1242- workMem ,
1243- randomAccess );
1252+ RUM_SORT_START (DATUM_SORT ,
1253+ false, /* no unique check */
1254+ 1 ,
1255+ workMem ,
1256+ randomAccess );
12441257
12451258 state -> comparetup = comparetup_datum ;
12461259 state -> copytup = copytup_datum ;
0 commit comments