From 933e8b5574859020b75302a9a3fd88cee06ddaf5 Mon Sep 17 00:00:00 2001
From: Pavel Borisov <pashkin.elfe@gmail.com>
Date: Fri, 14 Jan 2022 16:48:13 +0400
Subject: [PATCH 01/35] Fix travis CI config scripts

---
 .travis.yml          | 10 ++++++++--
 travis/Dockerfile.in |  1 +
 travis/run_tests.sh  |  7 +++++--
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 9dd95cb320..8952b507cd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -21,7 +21,13 @@ notifications:
         on_failure: always
 
 env:
-    - PG_VERSION=11 LEVEL=hardcore
+    - PG_VERSION=14
+    - PG_VERSION=14 LEVEL=hardcore
+    - PG_VERSION=13
+    - PG_VERSION=13 LEVEL=hardcore
+    - PG_VERSION=12
+    - PG_VERSION=12 LEVEL=hardcore
     - PG_VERSION=11
+    - PG_VERSION=11 LEVEL=hardcore
     - PG_VERSION=10
-    - PG_VERSION=9.6
+    - PG_VERSION=10 LEVEL=hardcore
diff --git a/travis/Dockerfile.in b/travis/Dockerfile.in
index 6c839839f0..2bfa60483d 100644
--- a/travis/Dockerfile.in
+++ b/travis/Dockerfile.in
@@ -2,6 +2,7 @@ FROM postgres:${PG_VERSION}-alpine
 
 # Install dependencies
 RUN apk add --no-cache \
+	linux-headers \
 	openssl curl \
 	perl perl-ipc-run \
 	make musl-dev gcc bison flex coreutils \
diff --git a/travis/run_tests.sh b/travis/run_tests.sh
index c1f598a196..5dff578c0e 100644
--- a/travis/run_tests.sh
+++ b/travis/run_tests.sh
@@ -36,7 +36,7 @@ if [ "$LEVEL" = "hardcore" ]; then
 
 	# enable additional options
 	./configure \
-		CFLAGS='-O0 -ggdb3 -fno-omit-frame-pointer' \
+		CFLAGS='-fno-omit-frame-pointer' \
 		--enable-cassert \
 		--prefix=$CUSTOM_PG_BIN \
 		--quiet
@@ -62,7 +62,10 @@ pg_config
 if [ "$LEVEL" = "hardcore" ]; then
 
 	# perform static analyzis
-	scan-build --status-bugs make USE_PGXS=1 || status=$?
+	scan-build --status-bugs \
+	-disable-checker core.UndefinedBinaryOperatorResult \
+	-disable-checker deadcode.DeadStores \
+	make USE_PGXS=1 || status=$?
 
 	# something's wrong, exit now!
 	if [ $status -ne 0 ]; then exit 1; fi

From d9cc86f2c52df37823a2c2e5d51aaa3c4a6c3afc Mon Sep 17 00:00:00 2001
From: Pavel Borisov <pashkin.elfe@gmail.com>
Date: Tue, 1 Mar 2022 15:50:54 +0400
Subject: [PATCH 02/35] Update copyrights

---
 src/rum.h             | 2 +-
 src/rum_arr_utils.c   | 2 +-
 src/rum_ts_utils.c    | 2 +-
 src/rumbtree.c        | 2 +-
 src/rumbulk.c         | 2 +-
 src/rumdatapage.c     | 2 +-
 src/rumentrypage.c    | 2 +-
 src/rumget.c          | 2 +-
 src/ruminsert.c       | 2 +-
 src/rumscan.c         | 2 +-
 src/rumsort.c         | 2 +-
 src/rumsort.h         | 2 +-
 src/rumtsquery.c      | 2 +-
 src/rumutil.c         | 2 +-
 src/rumvacuum.c       | 2 +-
 src/rumvalidate.c     | 2 +-
 tests/pglist_tests.py | 2 +-
 17 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/rum.h b/src/rum.h
index 8f54edd5d4..5103935ab1 100644
--- a/src/rum.h
+++ b/src/rum.h
@@ -3,7 +3,7 @@
  * rum.h
  *	  Exported definitions for RUM index.
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 2006-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rum_arr_utils.c b/src/rum_arr_utils.c
index 86fab36074..ed7e6dacfb 100644
--- a/src/rum_arr_utils.c
+++ b/src/rum_arr_utils.c
@@ -3,7 +3,7 @@
  * rum_arr_utils.c
  *		various anyarray-search functions
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rum_ts_utils.c b/src/rum_ts_utils.c
index 9729f13f1f..536fc5375b 100644
--- a/src/rum_ts_utils.c
+++ b/src/rum_ts_utils.c
@@ -3,7 +3,7 @@
  * rum_ts_utils.c
  *		various text-search functions
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rumbtree.c b/src/rumbtree.c
index 2e1e520df9..2c168b100d 100644
--- a/src/rumbtree.c
+++ b/src/rumbtree.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumbulk.c b/src/rumbulk.c
index b9e94df375..2b38bf46e3 100644
--- a/src/rumbulk.c
+++ b/src/rumbulk.c
@@ -4,7 +4,7 @@
  *	  routines for fast build of inverted index
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumdatapage.c b/src/rumdatapage.c
index 999b90e726..1533adb89b 100644
--- a/src/rumdatapage.c
+++ b/src/rumdatapage.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumentrypage.c b/src/rumentrypage.c
index c07fc3219a..9b759a1ff2 100644
--- a/src/rumentrypage.c
+++ b/src/rumentrypage.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumget.c b/src/rumget.c
index c48d191288..3834394477 100644
--- a/src/rumget.c
+++ b/src/rumget.c
@@ -4,7 +4,7 @@
  *	  fetch tuples from a RUM scan.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/ruminsert.c b/src/ruminsert.c
index f42c8a9526..852ee0679b 100644
--- a/src/ruminsert.c
+++ b/src/ruminsert.c
@@ -4,7 +4,7 @@
  *	  insert routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumscan.c b/src/rumscan.c
index 8048215971..65d781c710 100644
--- a/src/rumscan.c
+++ b/src/rumscan.c
@@ -4,7 +4,7 @@
  *	  routines to manage scans of inverted index relations
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumsort.c b/src/rumsort.c
index 9c08d74528..4ed425ccd2 100644
--- a/src/rumsort.c
+++ b/src/rumsort.c
@@ -8,7 +8,7 @@
  * src/backend/utils/sort/tuplesort.c.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumsort.h b/src/rumsort.h
index 8b6c9a645f..dfa5117bf1 100644
--- a/src/rumsort.h
+++ b/src/rumsort.h
@@ -7,7 +7,7 @@
  * It contains copy of static functions from
  * src/backend/utils/sort/tuplesort.c.
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumtsquery.c b/src/rumtsquery.c
index 0f10500c55..74189c37eb 100644
--- a/src/rumtsquery.c
+++ b/src/rumtsquery.c
@@ -3,7 +3,7 @@
  * rumtsquery.c
  *		Inverted fulltext search: indexing tsqueries.
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rumutil.c b/src/rumutil.c
index 93a52f534f..a9ff1ef981 100644
--- a/src/rumutil.c
+++ b/src/rumutil.c
@@ -4,7 +4,7 @@
  *	  utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumvacuum.c b/src/rumvacuum.c
index 35cca00308..07a584121a 100644
--- a/src/rumvacuum.c
+++ b/src/rumvacuum.c
@@ -4,7 +4,7 @@
  *	  delete & vacuum routines for the postgres RUM
  *
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumvalidate.c b/src/rumvalidate.c
index 1d73e1b73b..a8c9e91a8f 100644
--- a/src/rumvalidate.c
+++ b/src/rumvalidate.c
@@ -3,7 +3,7 @@
  * rumvalidate.c
  *	  Opclass validator for RUM.
  *
- * Portions Copyright (c) 2015-2019, Postgres Professional
+ * Portions Copyright (c) 2015-2021, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/tests/pglist_tests.py b/tests/pglist_tests.py
index a693a1b606..7b8e4558e0 100644
--- a/tests/pglist_tests.py
+++ b/tests/pglist_tests.py
@@ -2,7 +2,7 @@
 """
 	Test RUM index with big base 'pglist'
 
-	Copyright (c) 2015-2016, Postgres Professional
+	Copyright (c) 2015-2021, Postgres Professional
 """
 import unittest
 import os

From 5e8be0276192745c0fc0646fced74637d8652868 Mon Sep 17 00:00:00 2001
From: Pavel Borisov <pashkin.elfe@gmail.com>
Date: Fri, 6 May 2022 14:12:07 +0400
Subject: [PATCH 03/35] Compatibility with random access tuplesort interface
 changes in v15

Also update tuplesort15.c according to vanilla changes.
---
 src/rumsort.c     |  17 ++-
 src/tuplesort15.c | 379 +++++++++++++++++++++++++++++++++++++---------
 2 files changed, 324 insertions(+), 72 deletions(-)

diff --git a/src/rumsort.c b/src/rumsort.c
index 4ed425ccd2..6a0c920d9f 100644
--- a/src/rumsort.c
+++ b/src/rumsort.c
@@ -222,7 +222,11 @@ writetup_rum_internal(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup
 					 (void *) &writtenlen, sizeof(writtenlen));
 	LogicalTapeWrite(TAPE(state, LT_ARG),
 					 (void *) item, size);
-	if (state->randomAccess)	/* need trailing length word? */
+#if PG_VERSION_NUM >= 150000
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length word? */
+#else
+	if (state->randomAccess)        /* need trailing length word? */
+#endif
 		LogicalTapeWrite(TAPE(state, LT_ARG),
 						 (void *) &writtenlen, sizeof(writtenlen));
 }
@@ -260,11 +264,11 @@ readtup_rum_internal(RumTuplesortstate * state, SortTuple *stup,
 
 	if (!is_item)
 		stup->datum1 = Float8GetDatum(state->nKeys > 0 ? ((RumSortItem *) item)->data[0] : 0);
-
-	if (state->randomAccess)	/* need trailing length word? */
 #if PG_VERSION_NUM >= 150000
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length word? */
 		LogicalTapeReadExact(LT_ARG, &tuplen, sizeof(tuplen));
 #else
+	if (state->randomAccess)
 		LogicalTapeReadExact(state->tapeset, LT_ARG, &tuplen, sizeof(tuplen));
 #endif
 }
@@ -291,7 +295,14 @@ RumTuplesortstate *
 rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess,
 						bool compareItemPointer)
 {
+#if PG_VERSION_NUM >= 150000
+	RumTuplesortstate *state = tuplesort_begin_common(workMem,
+													  randomAccess ?
+													  TUPLESORT_RANDOMACCESS :
+													  TUPLESORT_NONE);
+#else
 	RumTuplesortstate *state = tuplesort_begin_common(workMem, randomAccess);
+#endif
 	MemoryContext oldcontext;
 
 	oldcontext = MemoryContextSwitchTo(state->sortcontext);
diff --git a/src/tuplesort15.c b/src/tuplesort15.c
index 90e26745df..e8da988a73 100644
--- a/src/tuplesort15.c
+++ b/src/tuplesort15.c
@@ -87,7 +87,7 @@
  * produce exactly one output run from their partial input.
  *
  *
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
@@ -246,7 +246,7 @@ struct Tuplesortstate
 {
 	TupSortStatus status;		/* enumerated value as shown above */
 	int			nKeys;			/* number of columns in sort key */
-	bool		randomAccess;	/* did caller request random access? */
+	int			sortopt;		/* Bitmask of flags used to setup sort */
 	bool		bounded;		/* did caller specify a maximum number of
 								 * tuples to return? */
 	bool		boundUsed;		/* true if we made use of a bounded heap */
@@ -306,6 +306,12 @@ struct Tuplesortstate
 	void		(*readtup) (Tuplesortstate *state, SortTuple *stup,
 							LogicalTape *tape, unsigned int len);
 
+	/*
+	 * Whether SortTuple's datum1 and isnull1 members are maintained by the
+	 * above routines.  If not, some sort specializations are disabled.
+	 */
+	bool		haveDatum1;
+
 	/*
 	 * This array holds the tuples now in sort memory.  If we are in state
 	 * INITIAL, the tuples are in no particular order; if we are in state
@@ -430,7 +436,11 @@ struct Tuplesortstate
 
 	/*
 	 * This variable is shared by the single-key MinimalTuple case and the
-	 * Datum case (which both use qsort_ssup()).  Otherwise it's NULL.
+	 * Datum case (which both use qsort_ssup()).  Otherwise, it's NULL.  The
+	 * presence of a value in this field is also checked by various sort
+	 * specialization functions as an optimization when comparing the leading
+	 * key in a tiebreak situation to determine if there are any subsequent
+	 * keys to sort on.
 	 */
 	SortSupport onlyKey;
 
@@ -459,6 +469,7 @@ struct Tuplesortstate
 
 	/* These are specific to the index_btree subcase: */
 	bool		enforceUnique;	/* complain if we find duplicate tuples */
+	bool		uniqueNullsNotDistinct;	/* unique constraint null treatment */
 
 	/* These are specific to the index_hash subcase: */
 	uint32		high_mask;		/* masks for sortable part of hash code */
@@ -557,12 +568,12 @@ struct Sharedsort
  * may or may not match the in-memory representation of the tuple ---
  * any conversion needed is the job of the writetup and readtup routines.
  *
- * If state->randomAccess is true, then the stored representation of the
- * tuple must be followed by another "unsigned int" that is a copy of the
- * length --- so the total tape space used is actually sizeof(unsigned int)
- * more than the stored length value.  This allows read-backwards.  When
- * randomAccess is not true, the write/read routines may omit the extra
- * length word.
+ * If state->sortopt contains TUPLESORT_RANDOMACCESS, then the stored
+ * representation of the tuple must be followed by another "unsigned int" that
+ * is a copy of the length --- so the total tape space used is actually
+ * sizeof(unsigned int) more than the stored length value.  This allows
+ * read-backwards.  When the random access flag was not specified, the
+ * write/read routines may omit the extra length word.
  *
  * writetup is expected to write both length words as well as the tuple
  * data.  When readtup is called, the tape is positioned just after the
@@ -607,7 +618,7 @@ struct Sharedsort
 
 static Tuplesortstate *tuplesort_begin_common(int workMem,
 											  SortCoordinate coordinate,
-											  bool randomAccess);
+											  int sortopt);
 static void tuplesort_begin_batch(Tuplesortstate *state);
 static void puttuple_common(Tuplesortstate *state, SortTuple *tuple);
 static bool consider_abort_common(Tuplesortstate *state);
@@ -668,14 +679,124 @@ static void free_sort_tuple(Tuplesortstate *state, SortTuple *stup);
 static void tuplesort_free(Tuplesortstate *state);
 static void tuplesort_updatemax(Tuplesortstate *state);
 
+/*
+ * Specialized comparators that we can inline into specialized sorts.  The goal
+ * is to try to sort two tuples without having to follow the pointers to the
+ * comparator or the tuple.
+ *
+ * XXX: For now, these fall back to comparator functions that will compare the
+ * leading datum a second time.
+ *
+ * XXX: For now, there is no specialization for cases where datum1 is
+ * authoritative and we don't even need to fall back to a callback at all (that
+ * would be true for types like int4/int8/timestamp/date, but not true for
+ * abbreviations of text or multi-key sorts.  There could be!  Is it worth it?
+ */
+
+/* Used if first key's comparator is ssup_datum_unsigned_compare */
+static pg_attribute_always_inline int
+qsort_tuple_unsigned_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
+{
+	int			compare;
+
+	compare = ApplyUnsignedSortComparator(a->datum1, a->isnull1,
+										  b->datum1, b->isnull1,
+										  &state->sortKeys[0]);
+	if (compare != 0)
+		return compare;
+
+	/*
+	 * No need to waste effort calling the tiebreak function when there are
+	 * no other keys to sort on.
+	 */
+	if (state->onlyKey != NULL)
+		return 0;
+
+	return state->comparetup(a, b, state);
+}
+
+/* Used if first key's comparator is ssup_datum_signed_compare */
+static pg_attribute_always_inline int
+qsort_tuple_signed_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
+{
+	int			compare;
+
+	compare = ApplySignedSortComparator(a->datum1, a->isnull1,
+										b->datum1, b->isnull1,
+										&state->sortKeys[0]);
+
+	if (compare != 0)
+		return compare;
+
+	/*
+	 * No need to waste effort calling the tiebreak function when there are
+	 * no other keys to sort on.
+	 */
+	if (state->onlyKey != NULL)
+		return 0;
+
+	return state->comparetup(a, b, state);
+}
+
+/* Used if first key's comparator is ssup_datum_int32_compare */
+static pg_attribute_always_inline int
+qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
+{
+	int			compare;
+
+	compare = ApplyInt32SortComparator(a->datum1, a->isnull1,
+										b->datum1, b->isnull1,
+										&state->sortKeys[0]);
+
+	if (compare != 0)
+		return compare;
+
+	/*
+	 * No need to waste effort calling the tiebreak function when there are
+	 * no other keys to sort on.
+	 */
+	if (state->onlyKey != NULL)
+		return 0;
+
+	return state->comparetup(a, b, state);
+}
+
 /*
  * Special versions of qsort just for SortTuple objects.  qsort_tuple() sorts
  * any variant of SortTuples, using the appropriate comparetup function.
  * qsort_ssup() is specialized for the case where the comparetup function
  * reduces to ApplySortComparator(), that is single-key MinimalTuple sorts
- * and Datum sorts.
+ * and Datum sorts.  qsort_tuple_{unsigned,signed,int32} are specialized for
+ * common comparison functions on pass-by-value leading datums.
  */
 
+#define ST_SORT qsort_tuple_unsigned
+#define ST_ELEMENT_TYPE SortTuple
+#define ST_COMPARE(a, b, state) qsort_tuple_unsigned_compare(a, b, state)
+#define ST_COMPARE_ARG_TYPE Tuplesortstate
+#define ST_CHECK_FOR_INTERRUPTS
+#define ST_SCOPE static
+#define ST_DEFINE
+#include "lib/sort_template.h"
+
+#define ST_SORT qsort_tuple_signed
+#define ST_ELEMENT_TYPE SortTuple
+#define ST_COMPARE(a, b, state) qsort_tuple_signed_compare(a, b, state)
+#define ST_COMPARE_ARG_TYPE Tuplesortstate
+#define ST_CHECK_FOR_INTERRUPTS
+#define ST_SCOPE static
+#define ST_DEFINE
+#include "lib/sort_template.h"
+
+#define ST_SORT qsort_tuple_int32
+#define ST_ELEMENT_TYPE SortTuple
+#define ST_COMPARE(a, b, state) qsort_tuple_int32_compare(a, b, state)
+#define ST_COMPARE_ARG_TYPE Tuplesortstate
+#define ST_CHECK_FOR_INTERRUPTS
+#define ST_SCOPE static
+#define ST_DEFINE
+#include "lib/sort_template.h"
+
 #define ST_SORT qsort_tuple
 #define ST_ELEMENT_TYPE SortTuple
 #define ST_COMPARE_RUNTIME_POINTER
@@ -712,21 +833,20 @@ static void tuplesort_updatemax(Tuplesortstate *state);
  * Each variant of tuplesort_begin has a workMem parameter specifying the
  * maximum number of kilobytes of RAM to use before spilling data to disk.
  * (The normal value of this parameter is work_mem, but some callers use
- * other values.)  Each variant also has a randomAccess parameter specifying
- * whether the caller needs non-sequential access to the sort result.
+ * other values.)  Each variant also has a sortopt which is a bitmask of
+ * sort options.  See TUPLESORT_* definitions in tuplesort.h
  */
 
 static Tuplesortstate *
-tuplesort_begin_common(int workMem, SortCoordinate coordinate,
-					   bool randomAccess)
+tuplesort_begin_common(int workMem, SortCoordinate coordinate, int sortopt)
 {
 	Tuplesortstate *state;
 	MemoryContext maincontext;
 	MemoryContext sortcontext;
 	MemoryContext oldcontext;
 
-	/* See leader_takeover_tapes() remarks on randomAccess support */
-	if (coordinate && randomAccess)
+	/* See leader_takeover_tapes() remarks on random access support */
+	if (coordinate && (sortopt & TUPLESORT_RANDOMACCESS))
 		elog(ERROR, "random access disallowed under parallel sort");
 
 	/*
@@ -763,7 +883,7 @@ tuplesort_begin_common(int workMem, SortCoordinate coordinate,
 		pg_rusage_init(&state->ru_start);
 #endif
 
-	state->randomAccess = randomAccess;
+	state->sortopt = sortopt;
 	state->tuples = true;
 
 	/*
@@ -842,11 +962,21 @@ tuplesort_begin_batch(Tuplesortstate *state)
 	 * eases memory management.  Resetting at key points reduces
 	 * fragmentation. Note that the memtuples array of SortTuples is allocated
 	 * in the parent context, not this context, because there is no need to
-	 * free memtuples early.
+	 * free memtuples early.  For bounded sorts, tuples may be pfreed in any
+	 * order, so we use a regular aset.c context so that it can make use of
+	 * free'd memory.  When the sort is not bounded, we make use of a
+	 * generation.c context as this keeps allocations more compact with less
+	 * wastage.  Allocations are also slightly more CPU efficient.
 	 */
-	state->tuplecontext = AllocSetContextCreate(state->sortcontext,
-												"Caller tuples",
-												ALLOCSET_DEFAULT_SIZES);
+	if (state->sortopt & TUPLESORT_ALLOWBOUNDED)
+		state->tuplecontext = AllocSetContextCreate(state->sortcontext,
+													"Caller tuples",
+													ALLOCSET_DEFAULT_SIZES);
+	else
+		state->tuplecontext = GenerationContextCreate(state->sortcontext,
+													  "Caller tuples",
+													  ALLOCSET_DEFAULT_SIZES);
+
 
 	state->status = TSS_INITIAL;
 	state->bounded = false;
@@ -897,10 +1027,10 @@ tuplesort_begin_heap(TupleDesc tupDesc,
 					 int nkeys, AttrNumber *attNums,
 					 Oid *sortOperators, Oid *sortCollations,
 					 bool *nullsFirstFlags,
-					 int workMem, SortCoordinate coordinate, bool randomAccess)
+					 int workMem, SortCoordinate coordinate, int sortopt)
 {
 	Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
-												   randomAccess);
+												   sortopt);
 	MemoryContext oldcontext;
 	int			i;
 
@@ -912,7 +1042,7 @@ tuplesort_begin_heap(TupleDesc tupDesc,
 	if (trace_sort)
 		elog(LOG,
 			 "begin tuple sort: nkeys = %d, workMem = %d, randomAccess = %c",
-			 nkeys, workMem, randomAccess ? 't' : 'f');
+			 nkeys, workMem, sortopt & TUPLESORT_RANDOMACCESS ? 't' : 'f');
 #endif
 
 	state->nKeys = nkeys;
@@ -921,13 +1051,14 @@ tuplesort_begin_heap(TupleDesc tupDesc,
 								false,	/* no unique check */
 								nkeys,
 								workMem,
-								randomAccess,
+								sortopt & TUPLESORT_RANDOMACCESS,
 								PARALLEL_SORT(state));
 
 	state->comparetup = comparetup_heap;
 	state->copytup = copytup_heap;
 	state->writetup = writetup_heap;
 	state->readtup = readtup_heap;
+	state->haveDatum1 = true;
 
 	state->tupDesc = tupDesc;	/* assume we need not copy tupDesc */
 	state->abbrevNext = 10;
@@ -947,7 +1078,7 @@ tuplesort_begin_heap(TupleDesc tupDesc,
 		sortKey->ssup_nulls_first = nullsFirstFlags[i];
 		sortKey->ssup_attno = attNums[i];
 		/* Convey if abbreviation optimization is applicable in principle */
-		sortKey->abbreviate = (i == 0);
+		sortKey->abbreviate = (i == 0 && state->haveDatum1);
 
 		PrepareSortSupportFromOrderingOp(sortOperators[i], sortKey);
 	}
@@ -970,10 +1101,10 @@ Tuplesortstate *
 tuplesort_begin_cluster(TupleDesc tupDesc,
 						Relation indexRel,
 						int workMem,
-						SortCoordinate coordinate, bool randomAccess)
+						SortCoordinate coordinate, int sortopt)
 {
 	Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
-												   randomAccess);
+												   sortopt);
 	BTScanInsert indexScanKey;
 	MemoryContext oldcontext;
 	int			i;
@@ -987,7 +1118,7 @@ tuplesort_begin_cluster(TupleDesc tupDesc,
 		elog(LOG,
 			 "begin tuple sort: nkeys = %d, workMem = %d, randomAccess = %c",
 			 RelationGetNumberOfAttributes(indexRel),
-			 workMem, randomAccess ? 't' : 'f');
+			 workMem, sortopt & TUPLESORT_RANDOMACCESS ? 't' : 'f');
 #endif
 
 	state->nKeys = IndexRelationGetNumberOfKeyAttributes(indexRel);
@@ -996,7 +1127,7 @@ tuplesort_begin_cluster(TupleDesc tupDesc,
 								false,	/* no unique check */
 								state->nKeys,
 								workMem,
-								randomAccess,
+								sortopt & TUPLESORT_RANDOMACCESS,
 								PARALLEL_SORT(state));
 
 	state->comparetup = comparetup_cluster;
@@ -1007,6 +1138,15 @@ tuplesort_begin_cluster(TupleDesc tupDesc,
 
 	state->indexInfo = BuildIndexInfo(indexRel);
 
+	/*
+	 * If we don't have a simple leading attribute, we don't currently
+	 * initialize datum1, so disable optimizations that require it.
+	 */
+	if (state->indexInfo->ii_IndexAttrNumbers[0] == 0)
+		state->haveDatum1 = false;
+	else
+		state->haveDatum1 = true;
+
 	state->tupDesc = tupDesc;	/* assume we need not copy tupDesc */
 
 	indexScanKey = _bt_mkscankey(indexRel, NULL);
@@ -1044,7 +1184,7 @@ tuplesort_begin_cluster(TupleDesc tupDesc,
 			(scanKey->sk_flags & SK_BT_NULLS_FIRST) != 0;
 		sortKey->ssup_attno = scanKey->sk_attno;
 		/* Convey if abbreviation optimization is applicable in principle */
-		sortKey->abbreviate = (i == 0);
+		sortKey->abbreviate = (i == 0 && state->haveDatum1);
 
 		AssertState(sortKey->ssup_attno != 0);
 
@@ -1065,12 +1205,13 @@ Tuplesortstate *
 tuplesort_begin_index_btree(Relation heapRel,
 							Relation indexRel,
 							bool enforceUnique,
+							bool uniqueNullsNotDistinct,
 							int workMem,
 							SortCoordinate coordinate,
-							bool randomAccess)
+							int sortopt)
 {
 	Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
-												   randomAccess);
+												   sortopt);
 	BTScanInsert indexScanKey;
 	MemoryContext oldcontext;
 	int			i;
@@ -1082,7 +1223,7 @@ tuplesort_begin_index_btree(Relation heapRel,
 		elog(LOG,
 			 "begin index sort: unique = %c, workMem = %d, randomAccess = %c",
 			 enforceUnique ? 't' : 'f',
-			 workMem, randomAccess ? 't' : 'f');
+			 workMem, sortopt & TUPLESORT_RANDOMACCESS ? 't' : 'f');
 #endif
 
 	state->nKeys = IndexRelationGetNumberOfKeyAttributes(indexRel);
@@ -1091,7 +1232,7 @@ tuplesort_begin_index_btree(Relation heapRel,
 								enforceUnique,
 								state->nKeys,
 								workMem,
-								randomAccess,
+								sortopt & TUPLESORT_RANDOMACCESS,
 								PARALLEL_SORT(state));
 
 	state->comparetup = comparetup_index_btree;
@@ -1099,10 +1240,12 @@ tuplesort_begin_index_btree(Relation heapRel,
 	state->writetup = writetup_index;
 	state->readtup = readtup_index;
 	state->abbrevNext = 10;
+	state->haveDatum1 = true;
 
 	state->heapRel = heapRel;
 	state->indexRel = indexRel;
 	state->enforceUnique = enforceUnique;
+	state->uniqueNullsNotDistinct = uniqueNullsNotDistinct;
 
 	indexScanKey = _bt_mkscankey(indexRel, NULL);
 
@@ -1122,7 +1265,7 @@ tuplesort_begin_index_btree(Relation heapRel,
 			(scanKey->sk_flags & SK_BT_NULLS_FIRST) != 0;
 		sortKey->ssup_attno = scanKey->sk_attno;
 		/* Convey if abbreviation optimization is applicable in principle */
-		sortKey->abbreviate = (i == 0);
+		sortKey->abbreviate = (i == 0 && state->haveDatum1);
 
 		AssertState(sortKey->ssup_attno != 0);
 
@@ -1147,10 +1290,10 @@ tuplesort_begin_index_hash(Relation heapRel,
 						   uint32 max_buckets,
 						   int workMem,
 						   SortCoordinate coordinate,
-						   bool randomAccess)
+						   int sortopt)
 {
 	Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
-												   randomAccess);
+												   sortopt);
 	MemoryContext oldcontext;
 
 	oldcontext = MemoryContextSwitchTo(state->maincontext);
@@ -1163,7 +1306,8 @@ tuplesort_begin_index_hash(Relation heapRel,
 			 high_mask,
 			 low_mask,
 			 max_buckets,
-			 workMem, randomAccess ? 't' : 'f');
+			 workMem,
+			 sortopt & TUPLESORT_RANDOMACCESS ? 't' : 'f');
 #endif
 
 	state->nKeys = 1;			/* Only one sort column, the hash code */
@@ -1172,6 +1316,7 @@ tuplesort_begin_index_hash(Relation heapRel,
 	state->copytup = copytup_index;
 	state->writetup = writetup_index;
 	state->readtup = readtup_index;
+	state->haveDatum1 = true;
 
 	state->heapRel = heapRel;
 	state->indexRel = indexRel;
@@ -1190,10 +1335,10 @@ tuplesort_begin_index_gist(Relation heapRel,
 						   Relation indexRel,
 						   int workMem,
 						   SortCoordinate coordinate,
-						   bool randomAccess)
+						   int sortopt)
 {
 	Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
-												   randomAccess);
+												   sortopt);
 	MemoryContext oldcontext;
 	int			i;
 
@@ -1203,7 +1348,7 @@ tuplesort_begin_index_gist(Relation heapRel,
 	if (trace_sort)
 		elog(LOG,
 			 "begin index sort: workMem = %d, randomAccess = %c",
-			 workMem, randomAccess ? 't' : 'f');
+			 workMem, sortopt & TUPLESORT_RANDOMACCESS ? 't' : 'f');
 #endif
 
 	state->nKeys = IndexRelationGetNumberOfKeyAttributes(indexRel);
@@ -1212,6 +1357,7 @@ tuplesort_begin_index_gist(Relation heapRel,
 	state->copytup = copytup_index;
 	state->writetup = writetup_index;
 	state->readtup = readtup_index;
+	state->haveDatum1 = true;
 
 	state->heapRel = heapRel;
 	state->indexRel = indexRel;
@@ -1229,7 +1375,7 @@ tuplesort_begin_index_gist(Relation heapRel,
 		sortKey->ssup_nulls_first = false;
 		sortKey->ssup_attno = i + 1;
 		/* Convey if abbreviation optimization is applicable in principle */
-		sortKey->abbreviate = (i == 0);
+		sortKey->abbreviate = (i == 0 && state->haveDatum1);
 
 		AssertState(sortKey->ssup_attno != 0);
 
@@ -1245,10 +1391,10 @@ tuplesort_begin_index_gist(Relation heapRel,
 Tuplesortstate *
 tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation,
 					  bool nullsFirstFlag, int workMem,
-					  SortCoordinate coordinate, bool randomAccess)
+					  SortCoordinate coordinate, int sortopt)
 {
 	Tuplesortstate *state = tuplesort_begin_common(workMem, coordinate,
-												   randomAccess);
+												   sortopt);
 	MemoryContext oldcontext;
 	int16		typlen;
 	bool		typbyval;
@@ -1259,7 +1405,7 @@ tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation,
 	if (trace_sort)
 		elog(LOG,
 			 "begin datum sort: workMem = %d, randomAccess = %c",
-			 workMem, randomAccess ? 't' : 'f');
+			 workMem, sortopt & TUPLESORT_RANDOMACCESS ? 't' : 'f');
 #endif
 
 	state->nKeys = 1;			/* always a one-column sort */
@@ -1268,7 +1414,7 @@ tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation,
 								false,	/* no unique check */
 								1,
 								workMem,
-								randomAccess,
+								sortopt & TUPLESORT_RANDOMACCESS,
 								PARALLEL_SORT(state));
 
 	state->comparetup = comparetup_datum;
@@ -1276,6 +1422,7 @@ tuplesort_begin_datum(Oid datumType, Oid sortOperator, Oid sortCollation,
 	state->writetup = writetup_datum;
 	state->readtup = readtup_datum;
 	state->abbrevNext = 10;
+	state->haveDatum1 = true;
 
 	state->datumType = datumType;
 
@@ -1334,6 +1481,8 @@ tuplesort_set_bound(Tuplesortstate *state, int64 bound)
 {
 	/* Assert we're called before loading any tuples */
 	Assert(state->status == TSS_INITIAL && state->memtupcount == 0);
+	/* Assert we allow bounded sorts */
+	Assert(state->sortopt & TUPLESORT_ALLOWBOUNDED);
 	/* Can't set the bound twice, either */
 	Assert(!state->bounded);
 	/* Also, this shouldn't be called in a parallel worker */
@@ -2162,7 +2311,7 @@ tuplesort_gettuple_common(Tuplesortstate *state, bool forward,
 	switch (state->status)
 	{
 		case TSS_SORTEDINMEM:
-			Assert(forward || state->randomAccess);
+			Assert(forward || state->sortopt & TUPLESORT_RANDOMACCESS);
 			Assert(!state->slabAllocatorUsed);
 			if (forward)
 			{
@@ -2206,7 +2355,7 @@ tuplesort_gettuple_common(Tuplesortstate *state, bool forward,
 			break;
 
 		case TSS_SORTEDONTAPE:
-			Assert(forward || state->randomAccess);
+			Assert(forward || state->sortopt & TUPLESORT_RANDOMACCESS);
 			Assert(state->slabAllocatorUsed);
 
 			/*
@@ -2981,7 +3130,8 @@ mergeruns(Tuplesortstate *state)
 			 * sorted tape, we can stop at this point and do the final merge
 			 * on-the-fly.
 			 */
-			if (!state->randomAccess && state->nInputRuns <= state->nInputTapes
+			if ((state->sortopt & TUPLESORT_RANDOMACCESS) == 0
+				&& state->nInputRuns <= state->nInputTapes
 				&& !WORKER(state))
 			{
 				/* Tell logtape.c we won't be writing anymore */
@@ -3063,7 +3213,6 @@ mergeonerun(Tuplesortstate *state)
 		{
 			stup.srctape = srcTapeIndex;
 			tuplesort_heap_replace_top(state, &stup);
-
 		}
 		else
 		{
@@ -3227,7 +3376,7 @@ tuplesort_rescan(Tuplesortstate *state)
 {
 	MemoryContext oldcontext = MemoryContextSwitchTo(state->sortcontext);
 
-	Assert(state->randomAccess);
+	Assert(state->sortopt & TUPLESORT_RANDOMACCESS);
 
 	switch (state->status)
 	{
@@ -3260,7 +3409,7 @@ tuplesort_markpos(Tuplesortstate *state)
 {
 	MemoryContext oldcontext = MemoryContextSwitchTo(state->sortcontext);
 
-	Assert(state->randomAccess);
+	Assert(state->sortopt & TUPLESORT_RANDOMACCESS);
 
 	switch (state->status)
 	{
@@ -3291,7 +3440,7 @@ tuplesort_restorepos(Tuplesortstate *state)
 {
 	MemoryContext oldcontext = MemoryContextSwitchTo(state->sortcontext);
 
-	Assert(state->randomAccess);
+	Assert(state->sortopt & TUPLESORT_RANDOMACCESS);
 
 	switch (state->status)
 	{
@@ -3503,15 +3652,53 @@ tuplesort_sort_memtuples(Tuplesortstate *state)
 
 	if (state->memtupcount > 1)
 	{
+		/*
+		 * Do we have the leading column's value or abbreviation in datum1,
+		 * and is there a specialization for its comparator?
+		 */
+		if (state->haveDatum1 && state->sortKeys)
+		{
+			if (state->sortKeys[0].comparator == ssup_datum_unsigned_cmp)
+			{
+				elog(DEBUG1, "qsort_tuple_unsigned");
+				qsort_tuple_unsigned(state->memtuples,
+									 state->memtupcount,
+									 state);
+				return;
+			}
+			else if (state->sortKeys[0].comparator == ssup_datum_signed_cmp)
+			{
+				elog(DEBUG1, "qsort_tuple_signed");
+				qsort_tuple_signed(state->memtuples,
+								   state->memtupcount,
+								   state);
+				return;
+			}
+			else if (state->sortKeys[0].comparator == ssup_datum_int32_cmp)
+			{
+				elog(DEBUG1, "qsort_tuple_int32");
+				qsort_tuple_int32(state->memtuples,
+								  state->memtupcount,
+								  state);
+				return;
+			}
+		}
+
 		/* Can we use the single-key sort function? */
 		if (state->onlyKey != NULL)
+		{
+			elog(DEBUG1, "qsort_ssup");
 			qsort_ssup(state->memtuples, state->memtupcount,
 					   state->onlyKey);
+		}
 		else
+		{
+			elog(DEBUG1, "qsort_tuple");
 			qsort_tuple(state->memtuples,
 						state->memtupcount,
 						state->comparetup,
 						state);
+		}
 	}
 }
 
@@ -3850,7 +4037,8 @@ writetup_heap(Tuplesortstate *state, LogicalTape *tape, SortTuple *stup)
 
 	LogicalTapeWrite(tape, (void *) &tuplen, sizeof(tuplen));
 	LogicalTapeWrite(tape, (void *) tupbody, tupbodylen);
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeWrite(tape, (void *) &tuplen, sizeof(tuplen));
 
 	if (!state->slabAllocatorUsed)
@@ -3873,7 +4061,8 @@ readtup_heap(Tuplesortstate *state, SortTuple *stup,
 	/* read in the tuple proper */
 	tuple->t_len = tuplen;
 	LogicalTapeReadExact(tape, tupbody, tupbodylen);
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
 	stup->tuple = (void *) tuple;
 	/* set up first-column key value */
@@ -3904,7 +4093,6 @@ comparetup_cluster(const SortTuple *a, const SortTuple *b,
 				datum2;
 	bool		isnull1,
 				isnull2;
-	AttrNumber	leading = state->indexInfo->ii_IndexAttrNumbers[0];
 
 	/* Be prepared to compare additional sort keys */
 	ltup = (HeapTuple) a->tuple;
@@ -3912,7 +4100,7 @@ comparetup_cluster(const SortTuple *a, const SortTuple *b,
 	tupDesc = state->tupDesc;
 
 	/* Compare the leading sort key, if it's simple */
-	if (leading != 0)
+	if (state->haveDatum1)
 	{
 		compare = ApplySortComparator(a->datum1, a->isnull1,
 									  b->datum1, b->isnull1,
@@ -3922,6 +4110,8 @@ comparetup_cluster(const SortTuple *a, const SortTuple *b,
 
 		if (sortKey->abbrev_converter)
 		{
+			AttrNumber	leading = state->indexInfo->ii_IndexAttrNumbers[0];
+
 			datum1 = heap_getattr(ltup, leading, tupDesc, &isnull1);
 			datum2 = heap_getattr(rtup, leading, tupDesc, &isnull2);
 
@@ -4019,7 +4209,7 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup)
 	 * set up first-column key value, and potentially abbreviate, if it's a
 	 * simple column
 	 */
-	if (state->indexInfo->ii_IndexAttrNumbers[0] == 0)
+	if (!state->haveDatum1)
 		return;
 
 	original = heap_getattr(tuple,
@@ -4084,7 +4274,8 @@ writetup_cluster(Tuplesortstate *state, LogicalTape *tape, SortTuple *stup)
 	LogicalTapeWrite(tape, &tuplen, sizeof(tuplen));
 	LogicalTapeWrite(tape, &tuple->t_self, sizeof(ItemPointerData));
 	LogicalTapeWrite(tape, tuple->t_data, tuple->t_len);
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeWrite(tape, &tuplen, sizeof(tuplen));
 
 	if (!state->slabAllocatorUsed)
@@ -4110,11 +4301,12 @@ readtup_cluster(Tuplesortstate *state, SortTuple *stup,
 	tuple->t_tableOid = InvalidOid;
 	/* Read in the tuple body */
 	LogicalTapeReadExact(tape, tuple->t_data, tuple->t_len);
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
 	stup->tuple = (void *) tuple;
 	/* set up first-column key value, if it's a simple column */
-	if (state->indexInfo->ii_IndexAttrNumbers[0] != 0)
+	if (state->haveDatum1)
 		stup->datum1 = heap_getattr(tuple,
 									state->indexInfo->ii_IndexAttrNumbers[0],
 									state->tupDesc,
@@ -4200,14 +4392,15 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b,
 
 	/*
 	 * If btree has asked us to enforce uniqueness, complain if two equal
-	 * tuples are detected (unless there was at least one NULL field).
+	 * tuples are detected (unless there was at least one NULL field and NULLS
+	 * NOT DISTINCT was not set).
 	 *
 	 * It is sufficient to make the test here, because if two tuples are equal
 	 * they *must* get compared at some stage of the sort --- otherwise the
 	 * sort algorithm wouldn't have checked whether one must appear before the
 	 * other.
 	 */
-	if (state->enforceUnique && !equal_hasnull)
+	if (state->enforceUnique && !(!state->uniqueNullsNotDistinct && equal_hasnull))
 	{
 		Datum		values[INDEX_MAX_KEYS];
 		bool		isnull[INDEX_MAX_KEYS];
@@ -4333,7 +4526,8 @@ writetup_index(Tuplesortstate *state, LogicalTape *tape, SortTuple *stup)
 	tuplen = IndexTupleSize(tuple) + sizeof(tuplen);
 	LogicalTapeWrite(tape, (void *) &tuplen, sizeof(tuplen));
 	LogicalTapeWrite(tape, (void *) tuple, IndexTupleSize(tuple));
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeWrite(tape, (void *) &tuplen, sizeof(tuplen));
 
 	if (!state->slabAllocatorUsed)
@@ -4351,7 +4545,8 @@ readtup_index(Tuplesortstate *state, SortTuple *stup,
 	IndexTuple	tuple = (IndexTuple) readtup_alloc(state, tuplen);
 
 	LogicalTapeReadExact(tape, tuple, tuplen);
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
 	stup->tuple = (void *) tuple;
 	/* set up first-column key value */
@@ -4421,7 +4616,8 @@ writetup_datum(Tuplesortstate *state, LogicalTape *tape, SortTuple *stup)
 
 	LogicalTapeWrite(tape, (void *) &writtenlen, sizeof(writtenlen));
 	LogicalTapeWrite(tape, waddr, tuplen);
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeWrite(tape, (void *) &writtenlen, sizeof(writtenlen));
 
 	if (!state->slabAllocatorUsed && stup->tuple)
@@ -4461,7 +4657,8 @@ readtup_datum(Tuplesortstate *state, SortTuple *stup,
 		stup->tuple = raddr;
 	}
 
-	if (state->randomAccess)	/* need trailing length word? */
+	if (state->sortopt & TUPLESORT_RANDOMACCESS)	/* need trailing length
+													 * word? */
 		LogicalTapeReadExact(tape, &tuplen, sizeof(tuplen));
 }
 
@@ -4696,3 +4893,47 @@ free_sort_tuple(Tuplesortstate *state, SortTuple *stup)
 		stup->tuple = NULL;
 	}
 }
+
+int
+ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup)
+{
+	if (x < y)
+		return -1;
+	else if (x > y)
+		return 1;
+	else
+		return 0;
+}
+
+int
+ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup)
+{
+#if SIZEOF_DATUM == 8
+	int64		xx = (int64) x;
+	int64		yy = (int64) y;
+#else
+	int32		xx = (int32) x;
+	int32		yy = (int32) y;
+#endif
+
+	if (xx < yy)
+		return -1;
+	else if (xx > yy)
+		return 1;
+	else
+		return 0;
+}
+
+int
+ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup)
+{
+	int32		xx = (int32) x;
+	int32		yy = (int32) y;
+
+	if (xx < yy)
+		return -1;
+	else if (xx > yy)
+		return 1;
+	else
+		return 0;
+}

From c538b9f9c29884c8356f6227470122667157e553 Mon Sep 17 00:00:00 2001
From: Pavel Borisov <pashkin.elfe@gmail.com>
Date: Thu, 26 May 2022 00:28:08 +0400
Subject: [PATCH 04/35] Update copyrights. Stamp 1.3.10

---
 README.md           | 4 ++++
 src/rum.h           | 4 ++--
 src/rum_arr_utils.c | 2 +-
 src/rum_ts_utils.c  | 4 ++--
 src/rumbtree.c      | 2 +-
 src/rumbulk.c       | 2 +-
 src/rumdatapage.c   | 2 +-
 src/rumentrypage.c  | 2 +-
 src/rumget.c        | 4 ++--
 src/ruminsert.c     | 2 +-
 src/rumscan.c       | 2 +-
 src/rumsort.c       | 4 ++--
 src/rumtsquery.c    | 2 +-
 src/rumutil.c       | 2 +-
 src/rumvacuum.c     | 2 +-
 src/rumvalidate.c   | 2 +-
 16 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/README.md b/README.md
index 74871571c0..667e1a3586 100644
--- a/README.md
+++ b/README.md
@@ -297,3 +297,7 @@ Oleg Bartunov <o.bartunov@postgrespro.ru> Postgres Professional Ltd., Russia
 Teodor Sigaev <teodor@postgrespro.ru> Postgres Professional Ltd., Russia
 
 Arthur Zakirov <a.zakirov@postgrespro.ru> Postgres Professional Ltd., Russia
+
+Pavel Borisov <p.borisov@postgrespro.com> Postgres Professional Ltd., Russia
+
+Maxim Orlov <m.orlov@postgrespro.ru> Postgres Professional Ltd., Russia
diff --git a/src/rum.h b/src/rum.h
index 5103935ab1..1b5b428e27 100644
--- a/src/rum.h
+++ b/src/rum.h
@@ -3,8 +3,8 @@
  * rum.h
  *	  Exported definitions for RUM index.
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
- * Portions Copyright (c) 2006-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2006-2022, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/rum_arr_utils.c b/src/rum_arr_utils.c
index ed7e6dacfb..1ee57dbe29 100644
--- a/src/rum_arr_utils.c
+++ b/src/rum_arr_utils.c
@@ -3,7 +3,7 @@
  * rum_arr_utils.c
  *		various anyarray-search functions
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rum_ts_utils.c b/src/rum_ts_utils.c
index 536fc5375b..97e3c37fda 100644
--- a/src/rum_ts_utils.c
+++ b/src/rum_ts_utils.c
@@ -3,8 +3,8 @@
  * rum_ts_utils.c
  *		various text-search functions
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
- * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/rumbtree.c b/src/rumbtree.c
index 2c168b100d..f513848da4 100644
--- a/src/rumbtree.c
+++ b/src/rumbtree.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumbulk.c b/src/rumbulk.c
index 2b38bf46e3..ee93df9fe9 100644
--- a/src/rumbulk.c
+++ b/src/rumbulk.c
@@ -4,7 +4,7 @@
  *	  routines for fast build of inverted index
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumdatapage.c b/src/rumdatapage.c
index 1533adb89b..723a8d3aae 100644
--- a/src/rumdatapage.c
+++ b/src/rumdatapage.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumentrypage.c b/src/rumentrypage.c
index 9b759a1ff2..5b0139d95e 100644
--- a/src/rumentrypage.c
+++ b/src/rumentrypage.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumget.c b/src/rumget.c
index 3834394477..032a8a1d94 100644
--- a/src/rumget.c
+++ b/src/rumget.c
@@ -4,8 +4,8 @@
  *	  fetch tuples from a RUM scan.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
- * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *-------------------------------------------------------------------------
diff --git a/src/ruminsert.c b/src/ruminsert.c
index 852ee0679b..5fe33c38f7 100644
--- a/src/ruminsert.c
+++ b/src/ruminsert.c
@@ -4,7 +4,7 @@
  *	  insert routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumscan.c b/src/rumscan.c
index 65d781c710..42bca53822 100644
--- a/src/rumscan.c
+++ b/src/rumscan.c
@@ -4,7 +4,7 @@
  *	  routines to manage scans of inverted index relations
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumsort.c b/src/rumsort.c
index 6a0c920d9f..39883b910f 100644
--- a/src/rumsort.c
+++ b/src/rumsort.c
@@ -8,8 +8,8 @@
  * src/backend/utils/sort/tuplesort.c.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
- * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *-------------------------------------------------------------------------
diff --git a/src/rumtsquery.c b/src/rumtsquery.c
index 74189c37eb..55cd49d19d 100644
--- a/src/rumtsquery.c
+++ b/src/rumtsquery.c
@@ -3,7 +3,7 @@
  * rumtsquery.c
  *		Inverted fulltext search: indexing tsqueries.
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rumutil.c b/src/rumutil.c
index a9ff1ef981..1d3719d15c 100644
--- a/src/rumutil.c
+++ b/src/rumutil.c
@@ -4,7 +4,7 @@
  *	  utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumvacuum.c b/src/rumvacuum.c
index 07a584121a..cce9cb09ee 100644
--- a/src/rumvacuum.c
+++ b/src/rumvacuum.c
@@ -4,7 +4,7 @@
  *	  delete & vacuum routines for the postgres RUM
  *
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumvalidate.c b/src/rumvalidate.c
index a8c9e91a8f..c4e7dc145f 100644
--- a/src/rumvalidate.c
+++ b/src/rumvalidate.c
@@ -3,7 +3,7 @@
  * rumvalidate.c
  *	  Opclass validator for RUM.
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2022, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *

From 6530adcd0251024b4b97adcadfee69454811dd7d Mon Sep 17 00:00:00 2001
From: Koval Dmitry <d.koval@postgrespro.ru>
Date: Mon, 4 Jul 2022 16:21:00 +0300
Subject: [PATCH 05/35] [PGPRO-6780] Fix Windows warnings

---
 src/rum.h          | 6 +++---
 src/rum_ts_utils.c | 2 +-
 src/rumsort.c      | 3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/rum.h b/src/rum.h
index 1b5b428e27..c242e699e4 100644
--- a/src/rum.h
+++ b/src/rum.h
@@ -868,9 +868,9 @@ extern Datum rum_anyarray_distance(PG_FUNCTION_ARGS);
 
 
 /* GUC parameters */
-extern PGDLLIMPORT int		RumFuzzySearchLimit;
-extern PGDLLIMPORT float8	RumArraySimilarityThreshold;
-extern PGDLLIMPORT int		RumArraySimilarityFunction;
+extern int		RumFuzzySearchLimit;
+extern float8	RumArraySimilarityThreshold;
+extern int		RumArraySimilarityFunction;
 
 
 /*
diff --git a/src/rum_ts_utils.c b/src/rum_ts_utils.c
index 97e3c37fda..62ccacf7c7 100644
--- a/src/rum_ts_utils.c
+++ b/src/rum_ts_utils.c
@@ -172,7 +172,7 @@ typedef struct
 	DocRepresentation *end;
 } Extention;
 
-static float weights[] = {1.0/0.1f, 1.0/0.2f, 1.0/0.4f, 1.0/1.0f};
+static float weights[] = {1.0f/0.1f, 1.0f/0.2f, 1.0f/0.4f, 1.0f/1.0f};
 
 /* A dummy WordEntryPos array to use when haspos is false */
 static WordEntryPosVector POSNULL = {
diff --git a/src/rumsort.c b/src/rumsort.c
index 39883b910f..045d166494 100644
--- a/src/rumsort.c
+++ b/src/rumsort.c
@@ -208,7 +208,10 @@ rum_item_size(RumTuplesortstate * state)
 	else if (state->copytup == copytup_rumitem)
 		return sizeof(RumScanItem);
 	else
+	{
 		elog (FATAL, "Unknown RUM state");
+		return 0;
+	}
 }
 
 static void

From 43465cba642788d069058d3adf65343e1aedbb1d Mon Sep 17 00:00:00 2001
From: Marina Polyakova <m.polyakova@postgrespro.ru>
Date: Mon, 21 Nov 2022 18:17:48 +0300
Subject: [PATCH 06/35] Fix compiler warnings due to new checks in PostgreSQL
 16
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See the commit 0fe954c28584169938e5c0738cfaa9930ce77577 (Add
-Wshadow=compatible-local to the standard compilation flags) in PostgreSQL 16.

src/ruminsert.c: In function ‘rumHeapTupleBulkInsert’:
src/ruminsert.c:533:51: warning: declaration of ‘attr’ shadows a previous local
[-Wshadow=compatible-local]
  533 |                                 Form_pg_attribute attr =
RumTupleDescAttr(
      |                                                   ^~~~
src/ruminsert.c:505:27: note: shadowed declaration is here
  505 |         Form_pg_attribute attr = buildstate->rumstate.addAttrs[attnum
- 1];
      |                           ^~~~
src/rumget.c: In function ‘startScanEntry’:
src/rumget.c:635:41: warning: declaration of ‘page’ shadows a previous local
[-Wshadow=compatible-local]
  635 |                         Page            page;
      |                                         ^~~~
src/rumget.c:548:25: note: shadowed declaration is here
  548 |         Page            page;
      |                         ^~~~
src/rumget.c: In function ‘entryGetNextItemList’:
src/rumget.c:1054:33: warning: declaration of ‘page’ shadows a previous local
[-Wshadow=compatible-local]
 1054 |                 Page            page;
      |                                 ^~~~
src/rumget.c:986:25: note: shadowed declaration is here
  986 |         Page            page;
      |                         ^~~~
---
 src/rumget.c    | 2 --
 src/ruminsert.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/rumget.c b/src/rumget.c
index 032a8a1d94..70773ed712 100644
--- a/src/rumget.c
+++ b/src/rumget.c
@@ -632,7 +632,6 @@ startScanEntry(RumState * rumstate, RumScanEntry entry, Snapshot snapshot)
 		{
 			BlockNumber rootPostingTree = RumGetPostingTree(itup);
 			RumPostingTreeScan *gdi;
-			Page		page;
 			OffsetNumber maxoff,
 						i;
 			Pointer		ptr;
@@ -1051,7 +1050,6 @@ entryGetNextItemList(RumState * rumstate, RumScanEntry entry, Snapshot snapshot)
 	{
 		BlockNumber rootPostingTree = RumGetPostingTree(itup);
 		RumPostingTreeScan *gdi;
-		Page		page;
 		OffsetNumber maxoff,
 					i;
 		Pointer		ptr;
diff --git a/src/ruminsert.c b/src/ruminsert.c
index 5fe33c38f7..e8b209dadf 100644
--- a/src/ruminsert.c
+++ b/src/ruminsert.c
@@ -530,11 +530,11 @@ rumHeapTupleBulkInsert(RumBuildState * buildstate, OffsetNumber attnum,
 			/* Check existance of additional information attribute in index */
 			if (!attr)
 			{
-				Form_pg_attribute attr = RumTupleDescAttr(
+				Form_pg_attribute current_attr = RumTupleDescAttr(
 					buildstate->rumstate.origTupdesc, attnum - 1);
 
 				elog(ERROR, "additional information attribute \"%s\" is not found in index",
-					 NameStr(attr->attname));
+					 NameStr(current_attr->attname));
 			}
 
 			addInfo[i] = datumCopy(addInfo[i], attr->attbyval, attr->attlen);

From bdfafedf7facbd077f0811f73ca0b961f4792903 Mon Sep 17 00:00:00 2001
From: Maxim Orlov <m.orlov@postgrespro.ru>
Date: Mon, 19 Dec 2022 14:33:52 +0300
Subject: [PATCH 07/35] Add PG15 into travis

---
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8b87257d44..d23094f134 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,8 +23,8 @@ notifications:
         on_failure: always
 
 env:
-    - PG_VERSION=15beta1
-    - PG_VERSION=15beta1 LEVEL=hardcore
+    - PG_VERSION=15
+    - PG_VERSION=15 LEVEL=hardcore
     - PG_VERSION=14
     - PG_VERSION=14 LEVEL=hardcore
     - PG_VERSION=13

From 41d60e823e23fa7c90e8cb5544592986b2ab78c3 Mon Sep 17 00:00:00 2001
From: Maxim Orlov <m.orlov@postgrespro.ru>
Date: Mon, 19 Dec 2022 14:33:52 +0300
Subject: [PATCH 08/35] Add PG15 into travis

---
 .travis.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8b87257d44..d23094f134 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,8 +23,8 @@ notifications:
         on_failure: always
 
 env:
-    - PG_VERSION=15beta1
-    - PG_VERSION=15beta1 LEVEL=hardcore
+    - PG_VERSION=15
+    - PG_VERSION=15 LEVEL=hardcore
     - PG_VERSION=14
     - PG_VERSION=14 LEVEL=hardcore
     - PG_VERSION=13

From 51c6af43f15c9368afe2bfaad365f483a4cb6d68 Mon Sep 17 00:00:00 2001
From: Maxim Orlov <m.orlov@postgrespro.ru>
Date: Mon, 19 Dec 2022 16:32:11 +0300
Subject: [PATCH 09/35] Disable core.DivideZero

Since all the errors are from pg-core code (i.e. tuplesortXX.c)
---
 travis/run_tests.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/travis/run_tests.sh b/travis/run_tests.sh
index 5dff578c0e..a1ea1e3e45 100644
--- a/travis/run_tests.sh
+++ b/travis/run_tests.sh
@@ -64,6 +64,7 @@ if [ "$LEVEL" = "hardcore" ]; then
 	# perform static analyzis
 	scan-build --status-bugs \
 	-disable-checker core.UndefinedBinaryOperatorResult \
+	-disable-checker core.DivideZero \
 	-disable-checker deadcode.DeadStores \
 	make USE_PGXS=1 || status=$?
 

From 61443b9309988858781bdee259d4722c30ccc1c3 Mon Sep 17 00:00:00 2001
From: Koval Dmitry <d.koval@postgrespro.ru>
Date: Fri, 25 Nov 2022 16:40:37 +0300
Subject: [PATCH 10/35] [PGPRO-7470] Added PGDLLEXPORT due to commit 8cf64d35

Tags: rum
---
 src/rum.h | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/rum.h b/src/rum.h
index c242e699e4..7bcfa18221 100644
--- a/src/rum.h
+++ b/src/rum.h
@@ -415,7 +415,7 @@ extern bytea *rumoptions(Datum reloptions, bool validate);
 extern bool rumproperty(Oid index_oid, int attno,
 			 IndexAMProperty prop, const char *propname,
 			 bool *res, bool *isnull);
-extern Datum rumhandler(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rumhandler(PG_FUNCTION_ARGS);
 extern void initRumState(RumState * state, Relation index);
 extern Buffer RumNewBuffer(Relation index);
 extern void RumInitBuffer(GenericXLogState *state, Buffer buffer, uint32 flags,
@@ -836,16 +836,16 @@ extern RumItem *rumGetBAEntry(BuildAccumulator *accum,
 #define RUM_ADDINFO_JOIN			10
 #define RUMNProcs					10
 
-extern Datum rum_extract_tsvector(PG_FUNCTION_ARGS);
-extern Datum rum_extract_tsquery(PG_FUNCTION_ARGS);
-extern Datum rum_tsvector_config(PG_FUNCTION_ARGS);
-extern Datum rum_tsquery_pre_consistent(PG_FUNCTION_ARGS);
-extern Datum rum_tsquery_distance(PG_FUNCTION_ARGS);
-extern Datum rum_ts_distance_tt(PG_FUNCTION_ARGS);
-extern Datum rum_ts_distance_ttf(PG_FUNCTION_ARGS);
-extern Datum rum_ts_distance_td(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_extract_tsvector(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_extract_tsquery(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_tsvector_config(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_tsquery_pre_consistent(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_tsquery_distance(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_ts_distance_tt(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_ts_distance_ttf(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_ts_distance_td(PG_FUNCTION_ARGS);
 
-extern Datum tsquery_to_distance_query(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum tsquery_to_distance_query(PG_FUNCTION_ARGS);
 
 /* rum_arr_utils.c */
 typedef enum SimilarityType
@@ -858,13 +858,13 @@ typedef enum SimilarityType
 #define RUM_SIMILARITY_FUNCTION_DEFAULT		SMT_COSINE
 #define RUM_SIMILARITY_THRESHOLD_DEFAULT	0.5
 
-extern Datum rum_anyarray_config(PG_FUNCTION_ARGS);
-extern Datum rum_extract_anyarray(PG_FUNCTION_ARGS);
-extern Datum rum_extract_anyarray_query(PG_FUNCTION_ARGS);
-extern Datum rum_anyarray_consistent(PG_FUNCTION_ARGS);
-extern Datum rum_anyarray_ordering(PG_FUNCTION_ARGS);
-extern Datum rum_anyarray_similar(PG_FUNCTION_ARGS);
-extern Datum rum_anyarray_distance(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_anyarray_config(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_extract_anyarray(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_extract_anyarray_query(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_anyarray_consistent(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_anyarray_ordering(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_anyarray_similar(PG_FUNCTION_ARGS);
+extern PGDLLEXPORT Datum rum_anyarray_distance(PG_FUNCTION_ARGS);
 
 
 /* GUC parameters */

From bfd9eba74067bedad0b4793138f056c1c16271ea Mon Sep 17 00:00:00 2001
From: Koval Dmitry <d.koval@postgrespro.ru>
Date: Mon, 4 Jul 2022 16:21:00 +0300
Subject: [PATCH 11/35] [PGPRO-6780] Fix Windows warnings

---
 src/rum.h          | 6 +++---
 src/rum_ts_utils.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/rum.h b/src/rum.h
index 1b5b428e27..c242e699e4 100644
--- a/src/rum.h
+++ b/src/rum.h
@@ -868,9 +868,9 @@ extern Datum rum_anyarray_distance(PG_FUNCTION_ARGS);
 
 
 /* GUC parameters */
-extern PGDLLIMPORT int		RumFuzzySearchLimit;
-extern PGDLLIMPORT float8	RumArraySimilarityThreshold;
-extern PGDLLIMPORT int		RumArraySimilarityFunction;
+extern int		RumFuzzySearchLimit;
+extern float8	RumArraySimilarityThreshold;
+extern int		RumArraySimilarityFunction;
 
 
 /*
diff --git a/src/rum_ts_utils.c b/src/rum_ts_utils.c
index 97e3c37fda..62ccacf7c7 100644
--- a/src/rum_ts_utils.c
+++ b/src/rum_ts_utils.c
@@ -172,7 +172,7 @@ typedef struct
 	DocRepresentation *end;
 } Extention;
 
-static float weights[] = {1.0/0.1f, 1.0/0.2f, 1.0/0.4f, 1.0/1.0f};
+static float weights[] = {1.0f/0.1f, 1.0f/0.2f, 1.0f/0.4f, 1.0f/1.0f};
 
 /* A dummy WordEntryPos array to use when haspos is false */
 static WordEntryPosVector POSNULL = {

From d387682c0eb222c0c23994dd4f13a7536482780a Mon Sep 17 00:00:00 2001
From: Marina Polyakova <m.polyakova@postgrespro.ru>
Date: Mon, 21 Nov 2022 18:17:48 +0300
Subject: [PATCH 12/35] Fix compiler warnings due to new checks in PostgreSQL
 16
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See the commit 0fe954c28584169938e5c0738cfaa9930ce77577 (Add
-Wshadow=compatible-local to the standard compilation flags) in PostgreSQL 16.

src/ruminsert.c: In function ‘rumHeapTupleBulkInsert’:
src/ruminsert.c:533:51: warning: declaration of ‘attr’ shadows a previous local
[-Wshadow=compatible-local]
  533 |                                 Form_pg_attribute attr =
RumTupleDescAttr(
      |                                                   ^~~~
src/ruminsert.c:505:27: note: shadowed declaration is here
  505 |         Form_pg_attribute attr = buildstate->rumstate.addAttrs[attnum
- 1];
      |                           ^~~~
src/rumget.c: In function ‘startScanEntry’:
src/rumget.c:635:41: warning: declaration of ‘page’ shadows a previous local
[-Wshadow=compatible-local]
  635 |                         Page            page;
      |                                         ^~~~
src/rumget.c:548:25: note: shadowed declaration is here
  548 |         Page            page;
      |                         ^~~~
src/rumget.c: In function ‘entryGetNextItemList’:
src/rumget.c:1054:33: warning: declaration of ‘page’ shadows a previous local
[-Wshadow=compatible-local]
 1054 |                 Page            page;
      |                                 ^~~~
src/rumget.c:986:25: note: shadowed declaration is here
  986 |         Page            page;
      |                         ^~~~
---
 src/rumget.c    | 2 --
 src/ruminsert.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/rumget.c b/src/rumget.c
index 032a8a1d94..70773ed712 100644
--- a/src/rumget.c
+++ b/src/rumget.c
@@ -632,7 +632,6 @@ startScanEntry(RumState * rumstate, RumScanEntry entry, Snapshot snapshot)
 		{
 			BlockNumber rootPostingTree = RumGetPostingTree(itup);
 			RumPostingTreeScan *gdi;
-			Page		page;
 			OffsetNumber maxoff,
 						i;
 			Pointer		ptr;
@@ -1051,7 +1050,6 @@ entryGetNextItemList(RumState * rumstate, RumScanEntry entry, Snapshot snapshot)
 	{
 		BlockNumber rootPostingTree = RumGetPostingTree(itup);
 		RumPostingTreeScan *gdi;
-		Page		page;
 		OffsetNumber maxoff,
 					i;
 		Pointer		ptr;
diff --git a/src/ruminsert.c b/src/ruminsert.c
index 5fe33c38f7..e8b209dadf 100644
--- a/src/ruminsert.c
+++ b/src/ruminsert.c
@@ -530,11 +530,11 @@ rumHeapTupleBulkInsert(RumBuildState * buildstate, OffsetNumber attnum,
 			/* Check existance of additional information attribute in index */
 			if (!attr)
 			{
-				Form_pg_attribute attr = RumTupleDescAttr(
+				Form_pg_attribute current_attr = RumTupleDescAttr(
 					buildstate->rumstate.origTupdesc, attnum - 1);
 
 				elog(ERROR, "additional information attribute \"%s\" is not found in index",
-					 NameStr(attr->attname));
+					 NameStr(current_attr->attname));
 			}
 
 			addInfo[i] = datumCopy(addInfo[i], attr->attbyval, attr->attlen);

From eceff466e46be8aefed80da2b3df70dcbf9867d9 Mon Sep 17 00:00:00 2001
From: Alexey Savchkov <a.savchkov@postgrespro.ru>
Date: Tue, 31 Jan 2023 14:56:46 +0700
Subject: [PATCH 13/35] Switch to Ubuntu 22.04 in Travis

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index d23094f134..7468e754b1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,6 @@
 os: linux
 
-dist: bionic
+dist: jammy
 
 language: c
 

From 3eecc1492454fdc9bf887d5cb1fd441a254985e9 Mon Sep 17 00:00:00 2001
From: Maxim Orlov <m.orlov@postgrespro.ru>
Date: Tue, 14 Feb 2023 18:11:47 +0300
Subject: [PATCH 14/35] Add tap test run in installcheck

---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index 570c44fdba..ee219590ac 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,8 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
     macaddr inet cidr text varchar char bytea bit varbit \
 	numeric rum_weight
 
+TAP_TESTS = 1
+
 ifdef USE_PGXS
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)

From 5a405c07c6d77958e12270908aa2d528289a3f8e Mon Sep 17 00:00:00 2001
From: Maxim Orlov <m.orlov@postgrespro.ru>
Date: Wed, 15 Feb 2023 11:26:38 +0300
Subject: [PATCH 15/35] Fix double tap test run on pg12+

---
 Makefile | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Makefile b/Makefile
index ee219590ac..89c81c96a9 100644
--- a/Makefile
+++ b/Makefile
@@ -51,10 +51,27 @@ else
 REGRESS += array
 endif
 
+# For 9.6-11 we have to make specific target with tap tests
+SPECIFIC_TAP =
+
+ifeq ($(MAJORVERSION), 9.6)
+SPECIFIC_TAP = yes
+endif
+
+ifeq ($(MAJORVERSION), 10)
+SPECIFIC_TAP = yes
+endif
+
+ifeq ($(MAJORVERSION), 11)
+SPECIFIC_TAP = yes
+endif
+
+ifdef SPECIFIC_TAP
 wal-check: temp-install
 	$(prove_check)
 
 check: wal-check
+endif
 
 all: $(SQL_built)
 

From c40b86eb70b3a2cba5d041312d495220a0099add Mon Sep 17 00:00:00 2001
From: Maxim Orlov <m.orlov@postgrespro.ru>
Date: Wed, 15 Feb 2023 14:36:40 +0300
Subject: [PATCH 16/35] Compacting SPECIFIC_TAP conditions

---
 Makefile | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/Makefile b/Makefile
index 89c81c96a9..1341f79b75 100644
--- a/Makefile
+++ b/Makefile
@@ -52,21 +52,7 @@ REGRESS += array
 endif
 
 # For 9.6-11 we have to make specific target with tap tests
-SPECIFIC_TAP =
-
-ifeq ($(MAJORVERSION), 9.6)
-SPECIFIC_TAP = yes
-endif
-
-ifeq ($(MAJORVERSION), 10)
-SPECIFIC_TAP = yes
-endif
-
-ifeq ($(MAJORVERSION), 11)
-SPECIFIC_TAP = yes
-endif
-
-ifdef SPECIFIC_TAP
+ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
 wal-check: temp-install
 	$(prove_check)
 

From 8c490862ca0a7fbfa8bf438e7f40efddcea99958 Mon Sep 17 00:00:00 2001
From: Koval Dmitry <d.koval@postgrespro.ru>
Date: Tue, 3 Oct 2023 23:15:25 +0300
Subject: [PATCH 17/35] [PGPRO-8894] Correction of expression calculation for
 case recheckPhrase=true

---
 Makefile           |  2 +-
 expected/expr.out  | 26 ++++++++++++++++++++++++++
 sql/expr.sql       | 21 +++++++++++++++++++++
 src/rum_ts_utils.c |  9 ++++++++-
 4 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100644 expected/expr.out
 create mode 100644 sql/expr.sql

diff --git a/Makefile b/Makefile
index 1341f79b75..f24246528f 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
 	int2 int4 int8 float4 float8 money oid \
     time timetz date interval \
     macaddr inet cidr text varchar char bytea bit varbit \
-	numeric rum_weight
+	numeric rum_weight expr
 
 TAP_TESTS = 1
 
diff --git a/expected/expr.out b/expected/expr.out
new file mode 100644
index 0000000000..b57de73ff4
--- /dev/null
+++ b/expected/expr.out
@@ -0,0 +1,26 @@
+CREATE TABLE documents (
+    en text not null,
+    score float not null,
+    textsearch_index_en_col tsvector
+);
+INSERT INTO documents VALUES ('the pet cat is in the shed', 56, to_tsvector('english', 'the pet cat is in the shed'));
+CREATE INDEX textsearch_index_en ON documents
+    USING rum (textsearch_index_en_col rum_tsvector_addon_ops, score)
+    WITH (attach = 'score', to = 'textsearch_index_en_col');
+SET enable_seqscan=off;
+-- should be 1 row
+SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
+             en             | score | textsearch_index_en_col  
+----------------------------+-------+--------------------------
+ the pet cat is in the shed |    56 | 'cat':3 'pet':2 'shed':7
+(1 row)
+
+SET enable_seqscan=on;
+-- 1 row
+SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
+             en             | score | textsearch_index_en_col  
+----------------------------+-------+--------------------------
+ the pet cat is in the shed |    56 | 'cat':3 'pet':2 'shed':7
+(1 row)
+
+DROP TABLE documents;
diff --git a/sql/expr.sql b/sql/expr.sql
new file mode 100644
index 0000000000..d7b7ee3d24
--- /dev/null
+++ b/sql/expr.sql
@@ -0,0 +1,21 @@
+CREATE TABLE documents (
+    en text not null,
+    score float not null,
+    textsearch_index_en_col tsvector
+);
+
+INSERT INTO documents VALUES ('the pet cat is in the shed', 56, to_tsvector('english', 'the pet cat is in the shed'));
+
+CREATE INDEX textsearch_index_en ON documents
+    USING rum (textsearch_index_en_col rum_tsvector_addon_ops, score)
+    WITH (attach = 'score', to = 'textsearch_index_en_col');
+
+SET enable_seqscan=off;
+-- should be 1 row
+SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
+
+SET enable_seqscan=on;
+-- 1 row
+SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
+
+DROP TABLE documents;
diff --git a/src/rum_ts_utils.c b/src/rum_ts_utils.c
index 62ccacf7c7..3133a92c5a 100644
--- a/src/rum_ts_utils.c
+++ b/src/rum_ts_utils.c
@@ -284,7 +284,14 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
 		 * addInfo
 		 */
 		if (gcv->recheckPhrase)
-			return ((val->weight) ? TS_MAYBE : TS_YES);
+		{
+			/*
+			 * We cannot return TS_YES here (if "val->weight > 0"), because
+			 * data->npos = 0 and we have incorrect porocessing of this result
+			 * at the upper levels. So return TS_MAYBE.
+			 */
+			return TS_MAYBE;
+		}
 
 		positions = DatumGetByteaP(gcv->addInfo[j]);
 		ptrt = (char *) VARDATA_ANY(positions);

From 61258f4cfd38e177912aa635e554fabc98dbdc5d Mon Sep 17 00:00:00 2001
From: Koval Dmitry <d.koval@postgrespro.ru>
Date: Wed, 4 Oct 2023 00:38:42 +0300
Subject: [PATCH 18/35] Changes for travis-ci

---
 .travis.yml          | 4 ++--
 travis/Dockerfile.in | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d23094f134..fd57d799d6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,6 +23,8 @@ notifications:
         on_failure: always
 
 env:
+    - PG_VERSION=16
+    - PG_VERSION=16 LEVEL=hardcore
     - PG_VERSION=15
     - PG_VERSION=15 LEVEL=hardcore
     - PG_VERSION=14
@@ -33,5 +35,3 @@ env:
     - PG_VERSION=12 LEVEL=hardcore
     - PG_VERSION=11
     - PG_VERSION=11 LEVEL=hardcore
-    - PG_VERSION=10
-    - PG_VERSION=10 LEVEL=hardcore
diff --git a/travis/Dockerfile.in b/travis/Dockerfile.in
index 2bfa60483d..66625248cc 100644
--- a/travis/Dockerfile.in
+++ b/travis/Dockerfile.in
@@ -4,10 +4,10 @@ FROM postgres:${PG_VERSION}-alpine
 RUN apk add --no-cache \
 	linux-headers \
 	openssl curl \
-	perl perl-ipc-run \
+	perl perl-ipc-run perl-dev perl-app-cpanminus perl-dbi \
 	make musl-dev gcc bison flex coreutils \
 	zlib-dev libedit-dev \
-	clang clang-analyzer;
+	pkgconf icu-dev clang clang15 clang-analyzer;
 
 # Environment
 ENV LANG=C.UTF-8 PGDATA=/pg/data

From e6ba1addec6eb598feda94da9e3a1a4de56b1e3a Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Wed, 11 Oct 2023 20:33:31 +0300
Subject: [PATCH 19/35] [PGPRO-8962] Remove unused variable.

Variable 'totalCount'.
It appeared in c1df4cc1ec1d86b5a06f28dfb0a8360a6f2f652c
and was already unnecessary.

Tags: rum.
---
 src/rumdatapage.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/rumdatapage.c b/src/rumdatapage.c
index 723a8d3aae..43fc1feb65 100644
--- a/src/rumdatapage.c
+++ b/src/rumdatapage.c
@@ -1060,7 +1060,6 @@ dataSplitPageLeaf(RumBtree btree, Buffer lbuf, Buffer rbuf,
 	RumItem		maxLeftItem,
 				curItem;
 	RumItem		item;
-	int			totalCount = 0;
 	int			maxItemIndex = btree->curitem;
 	/*
 	 * Must have lpageCopy MAXALIGNed to use PG macros to access data in
@@ -1100,7 +1099,6 @@ dataSplitPageLeaf(RumBtree btree, Buffer lbuf, Buffer rbuf,
 							   &item, &prevIptr, btree->rumstate, totalsize);
 
 			maxItemIndex++;
-			totalCount++;
 			maxItemSize = Max(maxItemSize, totalsize - prevTotalsize);
 		}
 
@@ -1112,7 +1110,6 @@ dataSplitPageLeaf(RumBtree btree, Buffer lbuf, Buffer rbuf,
 		totalsize = rumCheckPlaceToDataPageLeaf(btree->entryAttnum,
 							   &item, &prevIptr, btree->rumstate, totalsize);
 
-		totalCount++;
 		maxItemSize = Max(maxItemSize, totalsize - prevTotalsize);
 	}
 
@@ -1134,7 +1131,6 @@ dataSplitPageLeaf(RumBtree btree, Buffer lbuf, Buffer rbuf,
 				 2 * RumDataPageSize - 2 * maxItemSize - 2 * MAXIMUM_ALIGNOF)
 			{
 				maxItemIndex++;
-				totalCount++;
 				maxItemSize = Max(maxItemSize, newTotalsize - totalsize);
 				totalsize = newTotalsize;
 
@@ -1148,8 +1144,6 @@ dataSplitPageLeaf(RumBtree btree, Buffer lbuf, Buffer rbuf,
 			totalsize = rumCheckPlaceToDataPageLeaf(btree->entryAttnum,
 							   &item, &prevIptr, btree->rumstate, totalsize);
 			maxItemIndex++;
-
-			totalCount++;
 		}
 	}
 

From 6ccd0525648aac5bd4f39246861ce454e05af22d Mon Sep 17 00:00:00 2001
From: Koval Dmitry <d.koval@postgrespro.ru>
Date: Wed, 18 Oct 2023 02:53:18 +0300
Subject: [PATCH 20/35] [PGPRO-9026] Added check for attached column

---
 expected/rum_validate.out | 12 +++++++++++-
 sql/rum_validate.sql      |  8 +++++++-
 src/rumutil.c             |  3 +++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/expected/rum_validate.out b/expected/rum_validate.out
index e662615e87..22000a1ee5 100644
--- a/expected/rum_validate.out
+++ b/expected/rum_validate.out
@@ -114,9 +114,19 @@ SET enable_indexscan=on;
 SELECT a
 	FROM test_rum
 	WHERE a @@ to_tsquery('pg_catalog.english', 'bar')
-	ORDER BY a <=> (to_tsquery('pg_catalog.english', 'bar'),0)
+	ORDER BY a <=> (to_tsquery('pg_catalog.english', 'bar'),0);
               a               
 ------------------------------
  'bar':2,8 'foo':1,3,6 'qq':7
 (1 row)
 
+-- PGPRO-9026: column and attached column cannot be the same
+CREATE TABLE test_array (i int2[]);
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_addon_ops) WITH (attach = 'i', to = 'i');
+ERROR:  column "i" and attached column cannot be the same
+SELECT * FROM test_array WHERE i && '{1}';
+ i 
+---
+(0 rows)
+
+DROP TABLE test_array;
diff --git a/sql/rum_validate.sql b/sql/rum_validate.sql
index feb8e2765a..455db5db56 100644
--- a/sql/rum_validate.sql
+++ b/sql/rum_validate.sql
@@ -58,4 +58,10 @@ SET enable_indexscan=on;
 SELECT a
 	FROM test_rum
 	WHERE a @@ to_tsquery('pg_catalog.english', 'bar')
-	ORDER BY a <=> (to_tsquery('pg_catalog.english', 'bar'),0)
+	ORDER BY a <=> (to_tsquery('pg_catalog.english', 'bar'),0);
+
+-- PGPRO-9026: column and attached column cannot be the same
+CREATE TABLE test_array (i int2[]);
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_addon_ops) WITH (attach = 'i', to = 'i');
+SELECT * FROM test_array WHERE i && '{1}';
+DROP TABLE test_array;
diff --git a/src/rumutil.c b/src/rumutil.c
index 8838bd8aeb..9048918d12 100644
--- a/src/rumutil.c
+++ b/src/rumutil.c
@@ -211,6 +211,9 @@ initRumState(RumState * state, Relation index)
 
 			if (!AttributeNumberIsValid(state->attrnAddToColumn))
 				elog(ERROR, "attribute \"%s\" is not found in index", colname);
+
+			if (state->attrnAddToColumn == state->attrnAttachColumn)
+				elog(ERROR, "column \"%s\" and attached column cannot be the same", colname);
 		}
 
 		if (!(AttributeNumberIsValid(state->attrnAttachColumn) &&

From cb1edffc57736cd2a4455f8d0feab0d69928da25 Mon Sep 17 00:00:00 2001
From: alexandervpotapov <144983308+alexandervpotapov@users.noreply.github.com>
Date: Mon, 7 Oct 2024 21:03:41 +0300
Subject: [PATCH 21/35] Add compatibility with PostgreSQL 17. (#129)

Fix compiler error that was introduced by the commit 6ed83d5f (Use bump memory context for tuplesorts).
Fix 'array' test.
Fix Travis CI build.
---
 expected/array.out        |  16 +
 expected/array_1.out      |  16 +
 expected/array_2.out      | 899 ++++++++++++++++++++++++++++++++++++++
 expected/array_3.out      | 892 +++++++++++++++++++++++++++++++++++++
 sql/array.sql             |  19 +-
 src/rumsort.c             |  28 +-
 travis/docker-compose.yml |   3 +-
 7 files changed, 1869 insertions(+), 4 deletions(-)
 create mode 100644 expected/array_2.out
 create mode 100644 expected/array_3.out

diff --git a/expected/array.out b/expected/array.out
index 4094d98492..fe64c54f24 100644
--- a/expected/array.out
+++ b/expected/array.out
@@ -1,3 +1,19 @@
+/*
+ * ---------------------------------------------
+ *  NOTE: This test behaves differenly on PgPro
+ * ---------------------------------------------
+ *
+ * --------------------
+ *  array.sql and array_1.sql
+ * --------------------
+ * Test output for 64-bit and 32-bit systems respectively.
+ *
+ * --------------------
+ *  array_2.sql and array_3.sql
+ * --------------------
+ * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
+ * in the output has been changed.
+ */
 set enable_seqscan=off;
 set enable_sort=off;
 /*
diff --git a/expected/array_1.out b/expected/array_1.out
index ec3abfb693..3f3bf80bf0 100644
--- a/expected/array_1.out
+++ b/expected/array_1.out
@@ -1,3 +1,19 @@
+/*
+ * ---------------------------------------------
+ *  NOTE: This test behaves differenly on PgPro
+ * ---------------------------------------------
+ *
+ * --------------------
+ *  array.sql and array_1.sql
+ * --------------------
+ * Test output for 64-bit and 32-bit systems respectively.
+ *
+ * --------------------
+ *  array_2.sql and array_3.sql
+ * --------------------
+ * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
+ * in the output has been changed.
+ */
 set enable_seqscan=off;
 set enable_sort=off;
 /*
diff --git a/expected/array_2.out b/expected/array_2.out
new file mode 100644
index 0000000000..0097a5b5f4
--- /dev/null
+++ b/expected/array_2.out
@@ -0,0 +1,899 @@
+/*
+ * ---------------------------------------------
+ *  NOTE: This test behaves differenly on PgPro
+ * ---------------------------------------------
+ *
+ * --------------------
+ *  array.sql and array_1.sql
+ * --------------------
+ * Test output for 64-bit and 32-bit systems respectively.
+ *
+ * --------------------
+ *  array_2.sql and array_3.sql
+ * --------------------
+ * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
+ * in the output has been changed.
+ */
+set enable_seqscan=off;
+set enable_sort=off;
+/*
+ * Complete checks for int2[].
+ */
+CREATE TABLE test_array (
+	i int2[]
+);
+INSERT INTO test_array VALUES ('{}'), ('{0}'), ('{1,2,3,4}'), ('{1,2,3}'), ('{1,2}'), ('{1}');
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+SELECT NULL::int[] = '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] && '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] @> '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] <@ '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] % '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] <=> '{1}';
+ ?column? 
+----------
+         
+(1 row)
+
+INSERT INTO test_array VALUES (NULL);
+SELECT * FROM test_array WHERE i = '{1}';
+  i  
+-----
+ {1}
+(1 row)
+
+DELETE FROM test_array WHERE i IS NULL;
+SELECT * FROM test_array WHERE i = '{NULL}';
+ERROR:  array must not contain nulls
+SELECT * FROM test_array WHERE i = '{1,2,3,NULL}';
+ERROR:  array must not contain nulls
+SELECT * FROM test_array WHERE i = '{{1,2},{3,4}}';
+ERROR:  array must have 1 dimension
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i = '{}';
+ i  
+----
+ {}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{1}';
+  i  
+-----
+ {1}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{1,2}';
+   i   
+-------
+ {1,2}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{2,1}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i = '{1,2,3,3}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i = '{0,0}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i = '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i && '{}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i && '{1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i && '{3}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+(2 rows)
+
+SELECT * FROM test_array WHERE i && '{4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i && '{1,2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{1,2,3}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{1,2,3,4}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{4,3,2,1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{0,0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i && '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i @> '{}';
+     i     
+-----------
+ {}
+ {0}
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(6 rows)
+
+SELECT * FROM test_array WHERE i @> '{1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i @> '{2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i @> '{3}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+(2 rows)
+
+SELECT * FROM test_array WHERE i @> '{4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{1,2,4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{1,2,3,4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{4,3,2,1}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{0,0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i <@ '{}';
+ i  
+----
+ {}
+(1 row)
+
+SELECT * FROM test_array WHERE i <@ '{1}';
+  i  
+-----
+ {}
+ {1}
+(2 rows)
+
+SELECT * FROM test_array WHERE i <@ '{2}';
+ i  
+----
+ {}
+(1 row)
+
+SELECT * FROM test_array WHERE i <@ '{1,2,4}';
+   i   
+-------
+ {}
+ {1,2}
+ {1}
+(3 rows)
+
+SELECT * FROM test_array WHERE i <@ '{1,2,3,4}';
+     i     
+-----------
+ {}
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(5 rows)
+
+SELECT * FROM test_array WHERE i <@ '{4,3,2,1}';
+     i     
+-----------
+ {}
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(5 rows)
+
+SELECT * FROM test_array WHERE i <@ '{0,0}';
+  i  
+-----
+ {}
+ {0}
+(2 rows)
+
+SELECT * FROM test_array WHERE i <@ '{100}';
+ i  
+----
+ {}
+(1 row)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i % '{}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i % '{1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,4}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,3,4}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{4,3,2,1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,3,4,5}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i % '{1,10,20,30,40,50}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i % '{1,10,20,30}';
+  i  
+-----
+ {1}
+(1 row)
+
+SELECT * FROM test_array WHERE i % '{1,1,1,1,1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{0,0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i % '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{1}'::smallint[])
+   Order By: (i <=> '{1}'::smallint[])
+(3 rows)
+
+SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
+     i     
+-----------
+ {1}
+ {1,2}
+ {1,2,3}
+ {1,2,3,4}
+(4 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ADD COLUMN add_info timestamp;
+CREATE INDEX idx_array ON test_array
+USING rum (i rum_anyarray_addon_ops, add_info)
+WITH (attach = 'add_info', to = 'i');
+WITH q as (
+     SELECT row_number() OVER (ORDER BY i) idx, ctid FROM test_array
+)
+UPDATE test_array SET add_info = '2016-05-16 14:21:25'::timestamp +
+								 format('%s days', q.idx)::interval
+FROM q WHERE test_array.ctid = q.ctid;
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+            QUERY PLAN            
+----------------------------------
+ Seq Scan on test_array
+   Filter: (i % '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
+                                        QUERY PLAN                                        
+------------------------------------------------------------------------------------------
+ Limit
+   ->  Index Scan using idx_array on test_array
+         Index Cond: (i && '{1}'::smallint[])
+         Order By: (add_info <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
+     i     |         add_info         
+-----------+--------------------------
+ {1}       | Thu May 19 14:21:25 2016
+ {1,2}     | Fri May 20 14:21:25 2016
+ {1,2,3}   | Sat May 21 14:21:25 2016
+ {1,2,3,4} | Sun May 22 14:21:25 2016
+(4 rows)
+
+DROP INDEX idx_array;
+/*
+ * Sanity checks for popular array types.
+ */
+ALTER TABLE test_array ALTER COLUMN i TYPE int4[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::integer[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE int8[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::bigint[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE text[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::text[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE varchar[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                   QUERY PLAN                   
+------------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                   QUERY PLAN                   
+------------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                   QUERY PLAN                   
+------------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::character varying[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE char[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::bpchar[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE numeric[] USING i::numeric[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::numeric[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE float4[] USING i::float4[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::real[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE float8[] USING i::float8[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                  QUERY PLAN                  
+----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                  QUERY PLAN                  
+----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::double precision[])
+(2 rows)
+
+DROP INDEX idx_array;
+/*
+ * Check ordering using distance operator
+ */
+CREATE TABLE test_array_order (
+    i int2[]
+);
+\copy test_array_order(i) from 'data/rum_array.data';
+CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF)
+SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
+                      QUERY PLAN                      
+------------------------------------------------------
+ Index Scan using idx_array_order on test_array_order
+   Index Cond: (i @> '{23,20}'::smallint[])
+   Order By: (i <=> '{51}'::smallint[])
+(3 rows)
+
+SELECT i,
+	CASE WHEN distance = 'Infinity' THEN -1
+		ELSE distance::numeric(18,14)
+	END distance
+	FROM
+		(SELECT *, (i <=> '{51}') AS distance
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
+          i          |     distance     
+---------------------+------------------
+ {20,23,51}          | 1.73205080756888
+ {33,51,20,77,23,65} | 2.44948974278318
+ {6,97,20,89,23}     |               -1
+ {20,98,30,23,1,66}  |               -1
+ {57,23,39,46,50,20} |               -1
+ {81,20,26,22,23}    |               -1
+ {73,23,20}          |               -1
+ {18,23,10,90,15,20} |               -1
+ {23,76,34,23,2,20}  |               -1
+ {20,60,45,23,29}    |               -1
+ {23,89,38,20,40,95} |               -1
+ {23,20,72}          |               -1
+(12 rows)
+
diff --git a/expected/array_3.out b/expected/array_3.out
new file mode 100644
index 0000000000..d5012c3a38
--- /dev/null
+++ b/expected/array_3.out
@@ -0,0 +1,892 @@
+/*
+ * ---------------------------------------------
+ *  NOTE: This test behaves differenly on PgPro
+ * ---------------------------------------------
+ *
+ * --------------------
+ *  array.sql and array_1.sql
+ * --------------------
+ * Test output for 64-bit and 32-bit systems respectively.
+ *
+ * --------------------
+ *  array_2.sql and array_3.sql
+ * --------------------
+ * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
+ * in the output has been changed.
+ */
+set enable_seqscan=off;
+set enable_sort=off;
+/*
+ * Complete checks for int2[].
+ */
+CREATE TABLE test_array (
+	i int2[]
+);
+INSERT INTO test_array VALUES ('{}'), ('{0}'), ('{1,2,3,4}'), ('{1,2,3}'), ('{1,2}'), ('{1}');
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+SELECT NULL::int[] = '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] && '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] @> '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] <@ '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] % '{1}';
+ ?column? 
+----------
+ 
+(1 row)
+
+SELECT NULL::int[] <=> '{1}';
+ ?column? 
+----------
+         
+(1 row)
+
+INSERT INTO test_array VALUES (NULL);
+SELECT * FROM test_array WHERE i = '{1}';
+  i  
+-----
+ {1}
+(1 row)
+
+DELETE FROM test_array WHERE i IS NULL;
+SELECT * FROM test_array WHERE i = '{NULL}';
+ERROR:  array must not contain nulls
+SELECT * FROM test_array WHERE i = '{1,2,3,NULL}';
+ERROR:  array must not contain nulls
+SELECT * FROM test_array WHERE i = '{{1,2},{3,4}}';
+ERROR:  array must have 1 dimension
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i = '{}';
+ i  
+----
+ {}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{1}';
+  i  
+-----
+ {1}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{1,2}';
+   i   
+-------
+ {1,2}
+(1 row)
+
+SELECT * FROM test_array WHERE i = '{2,1}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i = '{1,2,3,3}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i = '{0,0}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i = '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i && '{}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i && '{1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i && '{3}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+(2 rows)
+
+SELECT * FROM test_array WHERE i && '{4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i && '{1,2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{1,2,3}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{1,2,3,4}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{4,3,2,1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{0,0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i && '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i @> '{}';
+     i     
+-----------
+ {}
+ {0}
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(6 rows)
+
+SELECT * FROM test_array WHERE i @> '{1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i @> '{2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i @> '{3}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+(2 rows)
+
+SELECT * FROM test_array WHERE i @> '{4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{1,2,4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{1,2,3,4}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{4,3,2,1}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{0,0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i @> '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i <@ '{}';
+ i  
+----
+ {}
+(1 row)
+
+SELECT * FROM test_array WHERE i <@ '{1}';
+  i  
+-----
+ {}
+ {1}
+(2 rows)
+
+SELECT * FROM test_array WHERE i <@ '{2}';
+ i  
+----
+ {}
+(1 row)
+
+SELECT * FROM test_array WHERE i <@ '{1,2,4}';
+   i   
+-------
+ {}
+ {1,2}
+ {1}
+(3 rows)
+
+SELECT * FROM test_array WHERE i <@ '{1,2,3,4}';
+     i     
+-----------
+ {}
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(5 rows)
+
+SELECT * FROM test_array WHERE i <@ '{4,3,2,1}';
+     i     
+-----------
+ {}
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(5 rows)
+
+SELECT * FROM test_array WHERE i <@ '{0,0}';
+  i  
+-----
+ {}
+ {0}
+(2 rows)
+
+SELECT * FROM test_array WHERE i <@ '{100}';
+ i  
+----
+ {}
+(1 row)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::smallint[])
+(2 rows)
+
+SELECT * FROM test_array WHERE i % '{}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i % '{1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,4}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,3,4}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{4,3,2,1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,3,4,5}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+(3 rows)
+
+SELECT * FROM test_array WHERE i % '{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}';
+     i     
+-----------
+ {1,2,3,4}
+(1 row)
+
+SELECT * FROM test_array WHERE i % '{1,10,20,30,40,50}';
+ i 
+---
+(0 rows)
+
+SELECT * FROM test_array WHERE i % '{1,10,20,30}';
+  i  
+-----
+ {1}
+(1 row)
+
+SELECT * FROM test_array WHERE i % '{1,1,1,1,1}';
+     i     
+-----------
+ {1,2,3,4}
+ {1,2,3}
+ {1,2}
+ {1}
+(4 rows)
+
+SELECT * FROM test_array WHERE i % '{0,0}';
+  i  
+-----
+ {0}
+(1 row)
+
+SELECT * FROM test_array WHERE i % '{100}';
+ i 
+---
+(0 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{1}'::smallint[])
+   Order By: (i <=> '{1}'::smallint[])
+(3 rows)
+
+SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
+     i     
+-----------
+ {1}
+ {1,2}
+ {1,2,3}
+ {1,2,3,4}
+(4 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ADD COLUMN add_info timestamp;
+CREATE INDEX idx_array ON test_array
+USING rum (i rum_anyarray_addon_ops, add_info)
+WITH (attach = 'add_info', to = 'i');
+WITH q as (
+     SELECT row_number() OVER (ORDER BY i) idx, ctid FROM test_array
+)
+UPDATE test_array SET add_info = '2016-05-16 14:21:25'::timestamp +
+								 format('%s days', q.idx)::interval
+FROM q WHERE test_array.ctid = q.ctid;
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+            QUERY PLAN            
+----------------------------------
+ Seq Scan on test_array
+   Filter: (i % '{}'::smallint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
+                                        QUERY PLAN                                        
+------------------------------------------------------------------------------------------
+ Limit
+   ->  Index Scan using idx_array on test_array
+         Index Cond: (i && '{1}'::smallint[])
+         Order By: (add_info <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
+(4 rows)
+
+SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
+ERROR:  doesn't support order by over pass-by-reference column
+DROP INDEX idx_array;
+/*
+ * Sanity checks for popular array types.
+ */
+ALTER TABLE test_array ALTER COLUMN i TYPE int4[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::integer[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::integer[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE int8[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::bigint[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::bigint[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE text[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::text[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::text[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE varchar[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                   QUERY PLAN                   
+------------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                   QUERY PLAN                   
+------------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                   QUERY PLAN                   
+------------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::character varying[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::character varying[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE char[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::bpchar[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::bpchar[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE numeric[] USING i::numeric[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::numeric[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::numeric[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE float4[] USING i::float4[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::real[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                QUERY PLAN                
+------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::real[])
+(2 rows)
+
+DROP INDEX idx_array;
+ALTER TABLE test_array ALTER COLUMN i TYPE float8[] USING i::float8[];
+CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
+                  QUERY PLAN                  
+----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i = '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i && '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i @> '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
+                  QUERY PLAN                   
+-----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i <@ '{}'::double precision[])
+(2 rows)
+
+EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
+                  QUERY PLAN                  
+----------------------------------------------
+ Index Scan using idx_array on test_array
+   Index Cond: (i % '{}'::double precision[])
+(2 rows)
+
+DROP INDEX idx_array;
+/*
+ * Check ordering using distance operator
+ */
+CREATE TABLE test_array_order (
+    i int2[]
+);
+\copy test_array_order(i) from 'data/rum_array.data';
+CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
+EXPLAIN (COSTS OFF)
+SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
+                      QUERY PLAN                      
+------------------------------------------------------
+ Index Scan using idx_array_order on test_array_order
+   Index Cond: (i @> '{23,20}'::smallint[])
+   Order By: (i <=> '{51}'::smallint[])
+(3 rows)
+
+SELECT i,
+	CASE WHEN distance = 'Infinity' THEN -1
+		ELSE distance::numeric(18,14)
+	END distance
+	FROM
+		(SELECT *, (i <=> '{51}') AS distance
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
+          i          |     distance     
+---------------------+------------------
+ {20,23,51}          | 1.73205080756888
+ {33,51,20,77,23,65} | 2.44948974278318
+ {18,23,10,90,15,20} |               -1
+ {23,76,34,23,2,20}  |               -1
+ {73,23,20}          |               -1
+ {23,89,38,20,40,95} |               -1
+ {23,20,72}          |               -1
+ {20,60,45,23,29}    |               -1
+ {81,20,26,22,23}    |               -1
+ {6,97,20,89,23}     |               -1
+ {20,98,30,23,1,66}  |               -1
+ {57,23,39,46,50,20} |               -1
+(12 rows)
+
diff --git a/sql/array.sql b/sql/array.sql
index 11defc9e07..c17c1252c8 100644
--- a/sql/array.sql
+++ b/sql/array.sql
@@ -1,7 +1,24 @@
+/*
+ * ---------------------------------------------
+ *  NOTE: This test behaves differenly on PgPro
+ * ---------------------------------------------
+ *
+ * --------------------
+ *  array.sql and array_1.sql
+ * --------------------
+ * Test output for 64-bit and 32-bit systems respectively.
+ *
+ * --------------------
+ *  array_2.sql and array_3.sql
+ * --------------------
+ * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
+ * in the output has been changed.
+ */
+
+
 set enable_seqscan=off;
 set enable_sort=off;
 
-
 /*
  * Complete checks for int2[].
  */
diff --git a/src/rumsort.c b/src/rumsort.c
index b5691301c9..96784cd192 100644
--- a/src/rumsort.c
+++ b/src/rumsort.c
@@ -488,11 +488,23 @@ rum_tuplesort_putrum(RumTuplesortstate *state, RumSortItem *item)
 {
 	MemoryContext oldcontext;
 	SortTuple stup;
+#if PG_VERSION_NUM >= 170000
+	MinimalTuple tuple = (MinimalTuple)item;
+	Size tuplen;
+	TuplesortPublic *base = TuplesortstateGetPublic((TuplesortPublic *)state);
+#endif
 
 	oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state));
 	copytup_rum(state, &stup, item);
 
-#if PG_VERSION_NUM >= 160000
+#if PG_VERSION_NUM >= 170000
+	/* GetMemoryChunkSpace is not supported for bump contexts */
+	if (TupleSortUseBumpTupleCxt(base->sortopt))
+		tuplen = MAXALIGN(tuple->t_len);
+	else
+		tuplen = GetMemoryChunkSpace(tuple);
+	tuplesort_puttuple_common(state, &stup, false, tuplen);
+#elif PG_VERSION_NUM >= 160000
 	tuplesort_puttuple_common(state, &stup, false);
 #else
 	puttuple_common(state, &stup);
@@ -506,11 +518,23 @@ rum_tuplesort_putrumitem(RumTuplesortstate *state, RumScanItem *item)
 {
 	MemoryContext oldcontext;
 	SortTuple stup;
+#if PG_VERSION_NUM >= 170000
+	MinimalTuple tuple = (MinimalTuple)item;
+	Size tuplen;
+	TuplesortPublic *base = TuplesortstateGetPublic((TuplesortPublic *)state);
+#endif
 
 	oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state));
 	copytup_rumitem(state, &stup, item);
 
-#if PG_VERSION_NUM >= 160000
+#if PG_VERSION_NUM >= 170000
+	/* GetMemoryChunkSpace is not supported for bump contexts */
+	if (TupleSortUseBumpTupleCxt(base->sortopt))
+		tuplen = MAXALIGN(tuple->t_len);
+	else
+		tuplen = GetMemoryChunkSpace(tuple);
+	tuplesort_puttuple_common(state, &stup, false, tuplen);
+#elif PG_VERSION_NUM >= 160000
 	tuplesort_puttuple_common(state, &stup, false);
 #else
 	puttuple_common(state, &stup);
diff --git a/travis/docker-compose.yml b/travis/docker-compose.yml
index 471ab779f2..0544d8597d 100644
--- a/travis/docker-compose.yml
+++ b/travis/docker-compose.yml
@@ -1,2 +1,3 @@
-tests:
+services:
+  tests:
     build: .

From 181b8027349c6f1677734a63141e839451c1015f Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Wed, 23 Oct 2024 15:06:38 +0300
Subject: [PATCH 22/35] Update configuration for Travis CI.

---
 .travis.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 428c4dc168..7ee9c5d4cd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -23,6 +23,8 @@ notifications:
         on_failure: always
 
 env:
+    - PG_VERSION=17
+    - PG_VERSION=17 LEVEL=hardcore
     - PG_VERSION=16
     - PG_VERSION=16 LEVEL=hardcore
     - PG_VERSION=15
@@ -35,3 +37,8 @@ env:
     - PG_VERSION=12 LEVEL=hardcore
     - PG_VERSION=11
     - PG_VERSION=11 LEVEL=hardcore
+
+matrix:
+    allow_failures:
+        - env: PG_VERSION=11
+        - env: PG_VERSION=11 LEVEL=hardcore
\ No newline at end of file

From 331863cd4ab4c9ff0c31f8407d0bf1e0292d90e4 Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Wed, 23 Oct 2024 15:58:29 +0300
Subject: [PATCH 23/35] Update copyrights.

---
 LICENSE                  | 2 +-
 src/disable_core_macro.h | 2 +-
 src/rum.h                | 2 +-
 src/rum_arr_utils.c      | 2 +-
 src/rum_ts_utils.c       | 2 +-
 src/rumbtree.c           | 2 +-
 src/rumbulk.c            | 2 +-
 src/rumdatapage.c        | 2 +-
 src/rumentrypage.c       | 2 +-
 src/rumget.c             | 2 +-
 src/ruminsert.c          | 2 +-
 src/rumscan.c            | 2 +-
 src/rumsort.c            | 2 +-
 src/rumsort.h            | 2 +-
 src/rumtsquery.c         | 2 +-
 src/rumutil.c            | 2 +-
 src/rumvacuum.c          | 2 +-
 src/rumvalidate.c        | 2 +-
 travis/run_tests.sh      | 2 +-
 19 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/LICENSE b/LICENSE
index 5b55f87617..a51596793f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 RUM is released under the PostgreSQL License, a liberal Open Source license, similar to the BSD or MIT licenses.
 
-Portions Copyright (c) 2015-2019, Postgres Professional
+Portions Copyright (c) 2015-2024, Postgres Professional
 Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
 Portions Copyright (c) 1994, The Regents of the University of California
 
diff --git a/src/disable_core_macro.h b/src/disable_core_macro.h
index 922ad4cf75..0d6c4a8a3b 100644
--- a/src/disable_core_macro.h
+++ b/src/disable_core_macro.h
@@ -3,7 +3,7 @@
  * disable_core_macro.h
  *	  Support including tuplesort.c from postgresql core code.
  *
- * Copyright (c) 2022, Postgres Professional
+ * Copyright (c) 2022-2024, Postgres Professional
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/rum.h b/src/rum.h
index 7bcfa18221..2139774d08 100644
--- a/src/rum.h
+++ b/src/rum.h
@@ -3,7 +3,7 @@
  * rum.h
  *	  Exported definitions for RUM index.
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 2006-2022, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rum_arr_utils.c b/src/rum_arr_utils.c
index 1ee57dbe29..d8dc00699a 100644
--- a/src/rum_arr_utils.c
+++ b/src/rum_arr_utils.c
@@ -3,7 +3,7 @@
  * rum_arr_utils.c
  *		various anyarray-search functions
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rum_ts_utils.c b/src/rum_ts_utils.c
index 3133a92c5a..d3b9c5478a 100644
--- a/src/rum_ts_utils.c
+++ b/src/rum_ts_utils.c
@@ -3,7 +3,7 @@
  * rum_ts_utils.c
  *		various text-search functions
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rumbtree.c b/src/rumbtree.c
index f513848da4..dfe2f10c30 100644
--- a/src/rumbtree.c
+++ b/src/rumbtree.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumbulk.c b/src/rumbulk.c
index ee93df9fe9..7a03bf64b4 100644
--- a/src/rumbulk.c
+++ b/src/rumbulk.c
@@ -4,7 +4,7 @@
  *	  routines for fast build of inverted index
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumdatapage.c b/src/rumdatapage.c
index 43fc1feb65..922bb7d19a 100644
--- a/src/rumdatapage.c
+++ b/src/rumdatapage.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumentrypage.c b/src/rumentrypage.c
index 5b0139d95e..29e1dd25bb 100644
--- a/src/rumentrypage.c
+++ b/src/rumentrypage.c
@@ -4,7 +4,7 @@
  *	  page utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumget.c b/src/rumget.c
index 70773ed712..ca5d83ee00 100644
--- a/src/rumget.c
+++ b/src/rumget.c
@@ -4,7 +4,7 @@
  *	  fetch tuples from a RUM scan.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/ruminsert.c b/src/ruminsert.c
index e8b209dadf..255e616c99 100644
--- a/src/ruminsert.c
+++ b/src/ruminsert.c
@@ -4,7 +4,7 @@
  *	  insert routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumscan.c b/src/rumscan.c
index 42bca53822..dd77f3de41 100644
--- a/src/rumscan.c
+++ b/src/rumscan.c
@@ -4,7 +4,7 @@
  *	  routines to manage scans of inverted index relations
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumsort.c b/src/rumsort.c
index 96784cd192..0c395f03e7 100644
--- a/src/rumsort.c
+++ b/src/rumsort.c
@@ -8,7 +8,7 @@
  * src/backend/utils/sort/tuplesort.c.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumsort.h b/src/rumsort.h
index dfa5117bf1..160aa5c8da 100644
--- a/src/rumsort.h
+++ b/src/rumsort.h
@@ -7,7 +7,7 @@
  * It contains copy of static functions from
  * src/backend/utils/sort/tuplesort.c.
  *
- * Portions Copyright (c) 2015-2021, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumtsquery.c b/src/rumtsquery.c
index 55cd49d19d..6c6b3c86d0 100644
--- a/src/rumtsquery.c
+++ b/src/rumtsquery.c
@@ -3,7 +3,7 @@
  * rumtsquery.c
  *		Inverted fulltext search: indexing tsqueries.
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  *
  *-------------------------------------------------------------------------
diff --git a/src/rumutil.c b/src/rumutil.c
index 9048918d12..4a239c85c7 100644
--- a/src/rumutil.c
+++ b/src/rumutil.c
@@ -4,7 +4,7 @@
  *	  utilities routines for the postgres inverted index access method.
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumvacuum.c b/src/rumvacuum.c
index cce9cb09ee..fd5e4206b4 100644
--- a/src/rumvacuum.c
+++ b/src/rumvacuum.c
@@ -4,7 +4,7 @@
  *	  delete & vacuum routines for the postgres RUM
  *
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/src/rumvalidate.c b/src/rumvalidate.c
index c4e7dc145f..0adbb10ac7 100644
--- a/src/rumvalidate.c
+++ b/src/rumvalidate.c
@@ -3,7 +3,7 @@
  * rumvalidate.c
  *	  Opclass validator for RUM.
  *
- * Portions Copyright (c) 2015-2022, Postgres Professional
+ * Portions Copyright (c) 2015-2024, Postgres Professional
  * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
diff --git a/travis/run_tests.sh b/travis/run_tests.sh
index a1ea1e3e45..aaebf3f200 100644
--- a/travis/run_tests.sh
+++ b/travis/run_tests.sh
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 
 #
-# Copyright (c) 2019, Postgres Professional
+# Copyright (c) 2019-2024, Postgres Professional
 #
 # supported levels:
 #		* standard

From 34619f96302f496e10e0cb6c9b4c28a846cf9a42 Mon Sep 17 00:00:00 2001
From: Arseny Kositsin <145198443+arseny114@users.noreply.github.com>
Date: Fri, 22 Nov 2024 12:44:12 +0300
Subject: [PATCH 24/35] Fixed the content of the error message (#133)

Fixed the content of the error message

If the "rum" index is created without the "WITH" operator,
two columns must be specified for "ORDER BY" to work.
But now error message in this case looks like:

  "ERROR: cannot order without attribute ... in WHERE clause"

Fixed the content of error message: "WHERE" replaced by "ORDER BY".

Added a test that checks the case when only one column is
specified in the "ORDER BY" and error message for this.

Tags: rum.
---
 expected/orderby.out | 5 +++++
 sql/orderby.sql      | 7 +++++++
 src/rumscan.c        | 2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/expected/orderby.out b/expected/orderby.out
index 9bc421970c..0f8a5454ef 100644
--- a/expected/orderby.out
+++ b/expected/orderby.out
@@ -460,6 +460,11 @@ SELECT id, d FROM tsts WHERE  t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
  458 | Fri May 20 21:21:22.326724 2016
 (3 rows)
 
+-- Test "ORDER BY" error message
+DROP INDEX tsts_idx;
+CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);
+SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
+ERROR:  cannot order without attribute 2 in ORDER BY clause
 -- Test multicolumn index
 RESET enable_indexscan;
 RESET enable_indexonlyscan;
diff --git a/sql/orderby.sql b/sql/orderby.sql
index 28e5b6038b..4c2689d193 100644
--- a/sql/orderby.sql
+++ b/sql/orderby.sql
@@ -95,6 +95,13 @@ SELECT id, d FROM tsts WHERE  t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER
 SELECT id, d FROM tsts WHERE  t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d ASC LIMIT 3;
 SELECT id, d FROM tsts WHERE  t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d DESC LIMIT 3;
 
+-- Test "ORDER BY" error message
+DROP INDEX tsts_idx;
+
+CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);
+
+SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
+
 -- Test multicolumn index
 
 RESET enable_indexscan;
diff --git a/src/rumscan.c b/src/rumscan.c
index dd77f3de41..089730fac4 100644
--- a/src/rumscan.c
+++ b/src/rumscan.c
@@ -214,7 +214,7 @@ rumFillScanKey(RumScanOpaque so, OffsetNumber attnum,
 				}
 
 				if (scanKey == NULL)
-					elog(ERROR, "cannot order without attribute %d in WHERE clause",
+					elog(ERROR, "cannot order without attribute %d in ORDER BY clause",
 						 key->attnum);
 				else if (scanKey->nentries > 1)
 					elog(ERROR, "scan key should contain only one value");

From f82ab184d53d347d8ef5b044b78ebbab922f3d0f Mon Sep 17 00:00:00 2001
From: Karina <55838532+Green-Chan@users.noreply.github.com>
Date: Fri, 6 Dec 2024 16:31:14 +0300
Subject: [PATCH 25/35] Stabilize array test. (#135)

Make this test output more independent of PostgreSQL server
version and system.

Authored-by: Karina Litskevich <k.lickevich@postgrespro.ru>
---
 expected/array.out   |  74 ++--
 expected/array_1.out |  74 ++--
 expected/array_2.out | 899 -------------------------------------------
 expected/array_3.out | 892 ------------------------------------------
 sql/array.sql        |  43 ++-
 5 files changed, 132 insertions(+), 1850 deletions(-)
 delete mode 100644 expected/array_2.out
 delete mode 100644 expected/array_3.out

diff --git a/expected/array.out b/expected/array.out
index fe64c54f24..1e45885ad1 100644
--- a/expected/array.out
+++ b/expected/array.out
@@ -7,12 +7,6 @@
  *  array.sql and array_1.sql
  * --------------------
  * Test output for 64-bit and 32-bit systems respectively.
- *
- * --------------------
- *  array_2.sql and array_3.sql
- * --------------------
- * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
- * in the output has been changed.
  */
 set enable_seqscan=off;
 set enable_sort=off;
@@ -859,41 +853,71 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
 DROP INDEX idx_array;
 /*
  * Check ordering using distance operator
+ *
+ * We want to check that index scan provides us correct ordering by distance
+ * operator. File 'data/rum_array.data' contains two arrays that statisfy
+ * i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
+ * that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
+ *
+ * When ordering by distance the order of this bunch of arrays with infinite
+ * distance is not determined and may depend of PostgreSQL version and system.
+ * We don't add another sort expression to ORDER BY because that might cause
+ * the planner to avoid using the index. Instead, we replace arrays that have
+ * infinite distance with {-1} to unambiguously determine the test output.
+ *
+ * 'Infinity' is printed differently in the output in different PostgreSQL
+ * versions, so we replace it with -1.
  */
 CREATE TABLE test_array_order (
     i int2[]
 );
 \copy test_array_order(i) from 'data/rum_array.data';
 CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
+/*
+ * Check that plan of the query uses ordering provided by index scan
+ */
 EXPLAIN (COSTS OFF)
-SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
-                      QUERY PLAN                      
-------------------------------------------------------
- Index Scan using idx_array_order on test_array_order
-   Index Cond: (i @> '{23,20}'::smallint[])
-   Order By: (i <=> '{51}'::smallint[])
-(3 rows)
+SELECT
+	CASE WHEN distance = 'Infinity' THEN '{-1}'
+		ELSE i
+	END i,
+	CASE WHEN distance = 'Infinity' THEN -1
+		ELSE distance::numeric(18,14)
+	END distance
+	FROM
+		(SELECT *, (i <=> '{51}') AS distance
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
+                         QUERY PLAN                         
+------------------------------------------------------------
+ Subquery Scan on t
+   ->  Index Scan using idx_array_order on test_array_order
+         Index Cond: (i @> '{23,20}'::smallint[])
+         Order By: (i <=> '{51}'::smallint[])
+(4 rows)
 
-SELECT i,
+SELECT
+	CASE WHEN distance = 'Infinity' THEN '{-1}'
+		ELSE i
+	END i,
 	CASE WHEN distance = 'Infinity' THEN -1
 		ELSE distance::numeric(18,14)
 	END distance
 	FROM
 		(SELECT *, (i <=> '{51}') AS distance
-		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
           i          |     distance     
 ---------------------+------------------
  {20,23,51}          | 1.73205080756888
  {33,51,20,77,23,65} | 2.44948974278318
- {23,76,34,23,2,20}  |               -1
- {20,60,45,23,29}    |               -1
- {23,89,38,20,40,95} |               -1
- {23,20,72}          |               -1
- {73,23,20}          |               -1
- {6,97,20,89,23}     |               -1
- {20,98,30,23,1,66}  |               -1
- {57,23,39,46,50,20} |               -1
- {81,20,26,22,23}    |               -1
- {18,23,10,90,15,20} |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
 (12 rows)
 
diff --git a/expected/array_1.out b/expected/array_1.out
index 3f3bf80bf0..c0876801bc 100644
--- a/expected/array_1.out
+++ b/expected/array_1.out
@@ -7,12 +7,6 @@
  *  array.sql and array_1.sql
  * --------------------
  * Test output for 64-bit and 32-bit systems respectively.
- *
- * --------------------
- *  array_2.sql and array_3.sql
- * --------------------
- * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
- * in the output has been changed.
  */
 set enable_seqscan=off;
 set enable_sort=off;
@@ -852,41 +846,71 @@ EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
 DROP INDEX idx_array;
 /*
  * Check ordering using distance operator
+ *
+ * We want to check that index scan provides us correct ordering by distance
+ * operator. File 'data/rum_array.data' contains two arrays that statisfy
+ * i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
+ * that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
+ *
+ * When ordering by distance the order of this bunch of arrays with infinite
+ * distance is not determined and may depend of PostgreSQL version and system.
+ * We don't add another sort expression to ORDER BY because that might cause
+ * the planner to avoid using the index. Instead, we replace arrays that have
+ * infinite distance with {-1} to unambiguously determine the test output.
+ *
+ * 'Infinity' is printed differently in the output in different PostgreSQL
+ * versions, so we replace it with -1.
  */
 CREATE TABLE test_array_order (
     i int2[]
 );
 \copy test_array_order(i) from 'data/rum_array.data';
 CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
+/*
+ * Check that plan of the query uses ordering provided by index scan
+ */
 EXPLAIN (COSTS OFF)
-SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
-                      QUERY PLAN                      
-------------------------------------------------------
- Index Scan using idx_array_order on test_array_order
-   Index Cond: (i @> '{23,20}'::smallint[])
-   Order By: (i <=> '{51}'::smallint[])
-(3 rows)
+SELECT
+	CASE WHEN distance = 'Infinity' THEN '{-1}'
+		ELSE i
+	END i,
+	CASE WHEN distance = 'Infinity' THEN -1
+		ELSE distance::numeric(18,14)
+	END distance
+	FROM
+		(SELECT *, (i <=> '{51}') AS distance
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
+                         QUERY PLAN                         
+------------------------------------------------------------
+ Subquery Scan on t
+   ->  Index Scan using idx_array_order on test_array_order
+         Index Cond: (i @> '{23,20}'::smallint[])
+         Order By: (i <=> '{51}'::smallint[])
+(4 rows)
 
-SELECT i,
+SELECT
+	CASE WHEN distance = 'Infinity' THEN '{-1}'
+		ELSE i
+	END i,
 	CASE WHEN distance = 'Infinity' THEN -1
 		ELSE distance::numeric(18,14)
 	END distance
 	FROM
 		(SELECT *, (i <=> '{51}') AS distance
-		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
           i          |     distance     
 ---------------------+------------------
  {20,23,51}          | 1.73205080756888
  {33,51,20,77,23,65} | 2.44948974278318
- {23,76,34,23,2,20}  |               -1
- {20,60,45,23,29}    |               -1
- {23,89,38,20,40,95} |               -1
- {23,20,72}          |               -1
- {73,23,20}          |               -1
- {6,97,20,89,23}     |               -1
- {20,98,30,23,1,66}  |               -1
- {57,23,39,46,50,20} |               -1
- {81,20,26,22,23}    |               -1
- {18,23,10,90,15,20} |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
+ {-1}                |               -1
 (12 rows)
 
diff --git a/expected/array_2.out b/expected/array_2.out
deleted file mode 100644
index 0097a5b5f4..0000000000
--- a/expected/array_2.out
+++ /dev/null
@@ -1,899 +0,0 @@
-/*
- * ---------------------------------------------
- *  NOTE: This test behaves differenly on PgPro
- * ---------------------------------------------
- *
- * --------------------
- *  array.sql and array_1.sql
- * --------------------
- * Test output for 64-bit and 32-bit systems respectively.
- *
- * --------------------
- *  array_2.sql and array_3.sql
- * --------------------
- * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
- * in the output has been changed.
- */
-set enable_seqscan=off;
-set enable_sort=off;
-/*
- * Complete checks for int2[].
- */
-CREATE TABLE test_array (
-	i int2[]
-);
-INSERT INTO test_array VALUES ('{}'), ('{0}'), ('{1,2,3,4}'), ('{1,2,3}'), ('{1,2}'), ('{1}');
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-SELECT NULL::int[] = '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] && '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] @> '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] <@ '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] % '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] <=> '{1}';
- ?column? 
-----------
-         
-(1 row)
-
-INSERT INTO test_array VALUES (NULL);
-SELECT * FROM test_array WHERE i = '{1}';
-  i  
------
- {1}
-(1 row)
-
-DELETE FROM test_array WHERE i IS NULL;
-SELECT * FROM test_array WHERE i = '{NULL}';
-ERROR:  array must not contain nulls
-SELECT * FROM test_array WHERE i = '{1,2,3,NULL}';
-ERROR:  array must not contain nulls
-SELECT * FROM test_array WHERE i = '{{1,2},{3,4}}';
-ERROR:  array must have 1 dimension
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i = '{}';
- i  
-----
- {}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{1}';
-  i  
------
- {1}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{1,2}';
-   i   
--------
- {1,2}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{2,1}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i = '{1,2,3,3}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i = '{0,0}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i = '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i && '{}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i && '{1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i && '{3}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
-(2 rows)
-
-SELECT * FROM test_array WHERE i && '{4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i && '{1,2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{1,2,3}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{1,2,3,4}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{4,3,2,1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{0,0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i && '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i @> '{}';
-     i     
------------
- {}
- {0}
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(6 rows)
-
-SELECT * FROM test_array WHERE i @> '{1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i @> '{2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i @> '{3}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
-(2 rows)
-
-SELECT * FROM test_array WHERE i @> '{4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{1,2,4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{1,2,3,4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{4,3,2,1}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{0,0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i <@ '{}';
- i  
-----
- {}
-(1 row)
-
-SELECT * FROM test_array WHERE i <@ '{1}';
-  i  
------
- {}
- {1}
-(2 rows)
-
-SELECT * FROM test_array WHERE i <@ '{2}';
- i  
-----
- {}
-(1 row)
-
-SELECT * FROM test_array WHERE i <@ '{1,2,4}';
-   i   
--------
- {}
- {1,2}
- {1}
-(3 rows)
-
-SELECT * FROM test_array WHERE i <@ '{1,2,3,4}';
-     i     
------------
- {}
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(5 rows)
-
-SELECT * FROM test_array WHERE i <@ '{4,3,2,1}';
-     i     
------------
- {}
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(5 rows)
-
-SELECT * FROM test_array WHERE i <@ '{0,0}';
-  i  
------
- {}
- {0}
-(2 rows)
-
-SELECT * FROM test_array WHERE i <@ '{100}';
- i  
-----
- {}
-(1 row)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i % '{}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i % '{1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,4}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,3,4}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{4,3,2,1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,3,4,5}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i % '{1,10,20,30,40,50}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i % '{1,10,20,30}';
-  i  
------
- {1}
-(1 row)
-
-SELECT * FROM test_array WHERE i % '{1,1,1,1,1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{0,0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i % '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{1}'::smallint[])
-   Order By: (i <=> '{1}'::smallint[])
-(3 rows)
-
-SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
-     i     
------------
- {1}
- {1,2}
- {1,2,3}
- {1,2,3,4}
-(4 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ADD COLUMN add_info timestamp;
-CREATE INDEX idx_array ON test_array
-USING rum (i rum_anyarray_addon_ops, add_info)
-WITH (attach = 'add_info', to = 'i');
-WITH q as (
-     SELECT row_number() OVER (ORDER BY i) idx, ctid FROM test_array
-)
-UPDATE test_array SET add_info = '2016-05-16 14:21:25'::timestamp +
-								 format('%s days', q.idx)::interval
-FROM q WHERE test_array.ctid = q.ctid;
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-            QUERY PLAN            
-----------------------------------
- Seq Scan on test_array
-   Filter: (i % '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
-                                        QUERY PLAN                                        
-------------------------------------------------------------------------------------------
- Limit
-   ->  Index Scan using idx_array on test_array
-         Index Cond: (i && '{1}'::smallint[])
-         Order By: (add_info <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
-     i     |         add_info         
------------+--------------------------
- {1}       | Thu May 19 14:21:25 2016
- {1,2}     | Fri May 20 14:21:25 2016
- {1,2,3}   | Sat May 21 14:21:25 2016
- {1,2,3,4} | Sun May 22 14:21:25 2016
-(4 rows)
-
-DROP INDEX idx_array;
-/*
- * Sanity checks for popular array types.
- */
-ALTER TABLE test_array ALTER COLUMN i TYPE int4[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::integer[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE int8[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::bigint[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE text[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::text[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE varchar[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                   QUERY PLAN                   
-------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                   QUERY PLAN                   
-------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                   QUERY PLAN                   
-------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::character varying[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE char[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::bpchar[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE numeric[] USING i::numeric[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::numeric[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE float4[] USING i::float4[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::real[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE float8[] USING i::float8[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                  QUERY PLAN                  
-----------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                  QUERY PLAN                  
-----------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::double precision[])
-(2 rows)
-
-DROP INDEX idx_array;
-/*
- * Check ordering using distance operator
- */
-CREATE TABLE test_array_order (
-    i int2[]
-);
-\copy test_array_order(i) from 'data/rum_array.data';
-CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF)
-SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
-                      QUERY PLAN                      
-------------------------------------------------------
- Index Scan using idx_array_order on test_array_order
-   Index Cond: (i @> '{23,20}'::smallint[])
-   Order By: (i <=> '{51}'::smallint[])
-(3 rows)
-
-SELECT i,
-	CASE WHEN distance = 'Infinity' THEN -1
-		ELSE distance::numeric(18,14)
-	END distance
-	FROM
-		(SELECT *, (i <=> '{51}') AS distance
-		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
-          i          |     distance     
----------------------+------------------
- {20,23,51}          | 1.73205080756888
- {33,51,20,77,23,65} | 2.44948974278318
- {6,97,20,89,23}     |               -1
- {20,98,30,23,1,66}  |               -1
- {57,23,39,46,50,20} |               -1
- {81,20,26,22,23}    |               -1
- {73,23,20}          |               -1
- {18,23,10,90,15,20} |               -1
- {23,76,34,23,2,20}  |               -1
- {20,60,45,23,29}    |               -1
- {23,89,38,20,40,95} |               -1
- {23,20,72}          |               -1
-(12 rows)
-
diff --git a/expected/array_3.out b/expected/array_3.out
deleted file mode 100644
index d5012c3a38..0000000000
--- a/expected/array_3.out
+++ /dev/null
@@ -1,892 +0,0 @@
-/*
- * ---------------------------------------------
- *  NOTE: This test behaves differenly on PgPro
- * ---------------------------------------------
- *
- * --------------------
- *  array.sql and array_1.sql
- * --------------------
- * Test output for 64-bit and 32-bit systems respectively.
- *
- * --------------------
- *  array_2.sql and array_3.sql
- * --------------------
- * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
- * in the output has been changed.
- */
-set enable_seqscan=off;
-set enable_sort=off;
-/*
- * Complete checks for int2[].
- */
-CREATE TABLE test_array (
-	i int2[]
-);
-INSERT INTO test_array VALUES ('{}'), ('{0}'), ('{1,2,3,4}'), ('{1,2,3}'), ('{1,2}'), ('{1}');
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-SELECT NULL::int[] = '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] && '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] @> '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] <@ '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] % '{1}';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT NULL::int[] <=> '{1}';
- ?column? 
-----------
-         
-(1 row)
-
-INSERT INTO test_array VALUES (NULL);
-SELECT * FROM test_array WHERE i = '{1}';
-  i  
------
- {1}
-(1 row)
-
-DELETE FROM test_array WHERE i IS NULL;
-SELECT * FROM test_array WHERE i = '{NULL}';
-ERROR:  array must not contain nulls
-SELECT * FROM test_array WHERE i = '{1,2,3,NULL}';
-ERROR:  array must not contain nulls
-SELECT * FROM test_array WHERE i = '{{1,2},{3,4}}';
-ERROR:  array must have 1 dimension
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i = '{}';
- i  
-----
- {}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{1}';
-  i  
------
- {1}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{1,2}';
-   i   
--------
- {1,2}
-(1 row)
-
-SELECT * FROM test_array WHERE i = '{2,1}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i = '{1,2,3,3}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i = '{0,0}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i = '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i && '{}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i && '{1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i && '{3}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
-(2 rows)
-
-SELECT * FROM test_array WHERE i && '{4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i && '{1,2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{1,2,3}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{1,2,3,4}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{4,3,2,1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{0,0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i && '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i @> '{}';
-     i     
------------
- {}
- {0}
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(6 rows)
-
-SELECT * FROM test_array WHERE i @> '{1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i @> '{2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i @> '{3}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
-(2 rows)
-
-SELECT * FROM test_array WHERE i @> '{4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{1,2,4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{1,2,3,4}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{4,3,2,1}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{0,0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i @> '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i <@ '{}';
- i  
-----
- {}
-(1 row)
-
-SELECT * FROM test_array WHERE i <@ '{1}';
-  i  
------
- {}
- {1}
-(2 rows)
-
-SELECT * FROM test_array WHERE i <@ '{2}';
- i  
-----
- {}
-(1 row)
-
-SELECT * FROM test_array WHERE i <@ '{1,2,4}';
-   i   
--------
- {}
- {1,2}
- {1}
-(3 rows)
-
-SELECT * FROM test_array WHERE i <@ '{1,2,3,4}';
-     i     
------------
- {}
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(5 rows)
-
-SELECT * FROM test_array WHERE i <@ '{4,3,2,1}';
-     i     
------------
- {}
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(5 rows)
-
-SELECT * FROM test_array WHERE i <@ '{0,0}';
-  i  
------
- {}
- {0}
-(2 rows)
-
-SELECT * FROM test_array WHERE i <@ '{100}';
- i  
-----
- {}
-(1 row)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::smallint[])
-(2 rows)
-
-SELECT * FROM test_array WHERE i % '{}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i % '{1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,4}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,3,4}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{4,3,2,1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,3,4,5}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
-(3 rows)
-
-SELECT * FROM test_array WHERE i % '{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}';
-     i     
------------
- {1,2,3,4}
-(1 row)
-
-SELECT * FROM test_array WHERE i % '{1,10,20,30,40,50}';
- i 
----
-(0 rows)
-
-SELECT * FROM test_array WHERE i % '{1,10,20,30}';
-  i  
------
- {1}
-(1 row)
-
-SELECT * FROM test_array WHERE i % '{1,1,1,1,1}';
-     i     
------------
- {1,2,3,4}
- {1,2,3}
- {1,2}
- {1}
-(4 rows)
-
-SELECT * FROM test_array WHERE i % '{0,0}';
-  i  
------
- {0}
-(1 row)
-
-SELECT * FROM test_array WHERE i % '{100}';
- i 
----
-(0 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{1}'::smallint[])
-   Order By: (i <=> '{1}'::smallint[])
-(3 rows)
-
-SELECT * FROM test_array WHERE i && '{1}' ORDER BY i <=> '{1}' ASC;
-     i     
------------
- {1}
- {1,2}
- {1,2,3}
- {1,2,3,4}
-(4 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ADD COLUMN add_info timestamp;
-CREATE INDEX idx_array ON test_array
-USING rum (i rum_anyarray_addon_ops, add_info)
-WITH (attach = 'add_info', to = 'i');
-WITH q as (
-     SELECT row_number() OVER (ORDER BY i) idx, ctid FROM test_array
-)
-UPDATE test_array SET add_info = '2016-05-16 14:21:25'::timestamp +
-								 format('%s days', q.idx)::interval
-FROM q WHERE test_array.ctid = q.ctid;
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-            QUERY PLAN            
-----------------------------------
- Seq Scan on test_array
-   Filter: (i % '{}'::smallint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
-                                        QUERY PLAN                                        
-------------------------------------------------------------------------------------------
- Limit
-   ->  Index Scan using idx_array on test_array
-         Index Cond: (i && '{1}'::smallint[])
-         Order By: (add_info <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)
-(4 rows)
-
-SELECT * FROM test_array WHERE i && '{1}' ORDER BY add_info <=> '2016-05-16 14:21:25' LIMIT 10;
-ERROR:  doesn't support order by over pass-by-reference column
-DROP INDEX idx_array;
-/*
- * Sanity checks for popular array types.
- */
-ALTER TABLE test_array ALTER COLUMN i TYPE int4[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::integer[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::integer[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE int8[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::bigint[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::bigint[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE text[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::text[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::text[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE varchar[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                   QUERY PLAN                   
-------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                   QUERY PLAN                   
-------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                   QUERY PLAN                   
-------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::character varying[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::character varying[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE char[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::bpchar[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::bpchar[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE numeric[] USING i::numeric[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::numeric[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::numeric[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE float4[] USING i::float4[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::real[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                QUERY PLAN                
-------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::real[])
-(2 rows)
-
-DROP INDEX idx_array;
-ALTER TABLE test_array ALTER COLUMN i TYPE float8[] USING i::float8[];
-CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i = '{}';
-                  QUERY PLAN                  
-----------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i = '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i && '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i && '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i @> '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i @> '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i <@ '{}';
-                  QUERY PLAN                   
------------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i <@ '{}'::double precision[])
-(2 rows)
-
-EXPLAIN (COSTS OFF) SELECT * FROM test_array WHERE i % '{}';
-                  QUERY PLAN                  
-----------------------------------------------
- Index Scan using idx_array on test_array
-   Index Cond: (i % '{}'::double precision[])
-(2 rows)
-
-DROP INDEX idx_array;
-/*
- * Check ordering using distance operator
- */
-CREATE TABLE test_array_order (
-    i int2[]
-);
-\copy test_array_order(i) from 'data/rum_array.data';
-CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
-EXPLAIN (COSTS OFF)
-SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
-                      QUERY PLAN                      
-------------------------------------------------------
- Index Scan using idx_array_order on test_array_order
-   Index Cond: (i @> '{23,20}'::smallint[])
-   Order By: (i <=> '{51}'::smallint[])
-(3 rows)
-
-SELECT i,
-	CASE WHEN distance = 'Infinity' THEN -1
-		ELSE distance::numeric(18,14)
-	END distance
-	FROM
-		(SELECT *, (i <=> '{51}') AS distance
-		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
-          i          |     distance     
----------------------+------------------
- {20,23,51}          | 1.73205080756888
- {33,51,20,77,23,65} | 2.44948974278318
- {18,23,10,90,15,20} |               -1
- {23,76,34,23,2,20}  |               -1
- {73,23,20}          |               -1
- {23,89,38,20,40,95} |               -1
- {23,20,72}          |               -1
- {20,60,45,23,29}    |               -1
- {81,20,26,22,23}    |               -1
- {6,97,20,89,23}     |               -1
- {20,98,30,23,1,66}  |               -1
- {57,23,39,46,50,20} |               -1
-(12 rows)
-
diff --git a/sql/array.sql b/sql/array.sql
index c17c1252c8..ba6886780d 100644
--- a/sql/array.sql
+++ b/sql/array.sql
@@ -7,12 +7,6 @@
  *  array.sql and array_1.sql
  * --------------------
  * Test output for 64-bit and 32-bit systems respectively.
- *
- * --------------------
- *  array_2.sql and array_3.sql
- * --------------------
- * Since 6ed83d5fa55c in PostgreSQL 17, the order of rows
- * in the output has been changed.
  */
 
 
@@ -216,6 +210,20 @@ DROP INDEX idx_array;
 
 /*
  * Check ordering using distance operator
+ *
+ * We want to check that index scan provides us correct ordering by distance
+ * operator. File 'data/rum_array.data' contains two arrays that statisfy
+ * i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
+ * that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
+ *
+ * When ordering by distance the order of this bunch of arrays with infinite
+ * distance is not determined and may depend of PostgreSQL version and system.
+ * We don't add another sort expression to ORDER BY because that might cause
+ * the planner to avoid using the index. Instead, we replace arrays that have
+ * infinite distance with {-1} to unambiguously determine the test output.
+ *
+ * 'Infinity' is printed differently in the output in different PostgreSQL
+ * versions, so we replace it with -1.
  */
 
 CREATE TABLE test_array_order (
@@ -225,12 +233,29 @@ CREATE TABLE test_array_order (
 
 CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
 
+/*
+ * Check that plan of the query uses ordering provided by index scan
+ */
+
 EXPLAIN (COSTS OFF)
-SELECT *, i <=> '{51}' from test_array_order WHERE i @> '{23,20}' order by i <=> '{51}';
-SELECT i,
+SELECT
+	CASE WHEN distance = 'Infinity' THEN '{-1}'
+		ELSE i
+	END i,
+	CASE WHEN distance = 'Infinity' THEN -1
+		ELSE distance::numeric(18,14)
+	END distance
+	FROM
+		(SELECT *, (i <=> '{51}') AS distance
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;
+
+SELECT
+	CASE WHEN distance = 'Infinity' THEN '{-1}'
+		ELSE i
+	END i,
 	CASE WHEN distance = 'Infinity' THEN -1
 		ELSE distance::numeric(18,14)
 	END distance
 	FROM
 		(SELECT *, (i <=> '{51}') AS distance
-		FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t;
+		FROM test_array_order WHERE i @> '{23,20}' ORDER BY distance) t;

From 2f03e1b21c741ab80bba90e16ca1033c40df3e91 Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Wed, 6 Nov 2024 14:28:24 +0300
Subject: [PATCH 26/35] Remake of pglist_test.py but on the perl.

This test download dump of big test base pglist to /pglist_tmp
directory. Delete folder pglist_tmp during 'make clean'.
Run new test only in case PG_TEST_EXTRA contain 'big_values'.
---
 Makefile              |   2 +
 README.md             |  20 ++++
 t/002_pglist.pl       | 207 ++++++++++++++++++++++++++++++++++++++++++
 tests/README.md       |  14 ---
 tests/__init__.py     |   0
 tests/pglist_tests.py | 157 --------------------------------
 travis/run_tests.sh   |   1 +
 7 files changed, 230 insertions(+), 171 deletions(-)
 create mode 100644 t/002_pglist.pl
 delete mode 100644 tests/README.md
 delete mode 100644 tests/__init__.py
 delete mode 100644 tests/pglist_tests.py

diff --git a/Makefile b/Makefile
index f24246528f..ab4ee1df38 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,8 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
 
 TAP_TESTS = 1
 
+EXTRA_CLEAN = pglist_tmp
+
 ifdef USE_PGXS
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
diff --git a/README.md b/README.md
index 5f3e6887cf..b6fb08420c 100644
--- a/README.md
+++ b/README.md
@@ -60,6 +60,26 @@ Typical installation procedure may look like this:
 
 > **Important:** Don't forget to set the `PG_CONFIG` variable in case you want to test `RUM` on a custom build of PostgreSQL. Read more [here](https://wiki.postgresql.org/wiki/Building_and_Installing_PostgreSQL_Extension_Modules).
 
+## Tests
+
+$ make check
+
+This command runs:
+- regression tests;
+- isolation tests;
+- tap tests.
+
+    One of the tap tests downloads a 1GB archive and then unpacks it
+    into a file weighing almost 3GB. It is disabled by default.
+
+    To run this test, you need to set an environment variable:
+
+        $ export PG_TEST_EXTRA=big_values
+
+    The way to turn it off again:
+
+        $ export -n PG_TEST_EXTRA
+
 ## Common operators and functions
 
 The **rum** module provides next operators.
diff --git a/t/002_pglist.pl b/t/002_pglist.pl
new file mode 100644
index 0000000000..7b2d76c058
--- /dev/null
+++ b/t/002_pglist.pl
@@ -0,0 +1,207 @@
+# Test RUM index with big base 'pglist'.
+use strict;
+use warnings;
+use Config;
+use Test::More;
+
+plan skip_all => 'This test requires downloading a 1GB archive. ' .
+				 'The unpacked file weighs almost 3GB. ' .
+				 'Perform only if the big_values is enabled in PG_TEST_EXTRA'
+	unless $ENV{PG_TEST_EXTRA} && $ENV{PG_TEST_EXTRA} =~ /\bbig_values\b/;
+
+plan tests => 4;
+
+my $node;
+
+# Utility function
+
+sub file_exists
+{
+	my ($file) = @_;
+	return -e $file;
+}
+
+# Check the existence of the test base, install if necessary
+
+sub install_pglist
+{
+	my $dir = Cwd->getcwd; #current directory
+
+	my %config = (
+		#directory with pglist dump must be inside the current directory
+		pglist_tmp_dir	=> $dir . '/pglist_tmp/',
+		dump_name		=> 'pglist-28-04-16.dump',
+		dump_url		=> 'http://www.sai.msu.su/~megera/postgres/files/pglist-28-04-16.dump.gz',
+		pglist_archive	=> $dir . '/pglist_tmp/' . 'pglist-28-04-16.dump.gz',
+	);
+
+	my $path_to_dump = $config{pglist_tmp_dir} . $config{dump_name};
+
+	if (file_exists($path_to_dump))
+	{
+		note($config{dump_name} . ' already installed');
+	}
+	else
+	{
+		# Create folder /contrib/rum/pglist_tmp if not already exists
+		mkdir($config{pglist_tmp_dir}, 0700)
+			unless file_exists($config{pglist_tmp_dir});
+
+		# Download archive pglist-28-04-16.dump.gz if not already exists
+		unless (file_exists($config{pglist_archive}))
+		{
+			note('Downloading pglist dump in ' . $config{pglist_archive});
+
+			# Flag "-nv" allows us to avoid frequent messages
+			# about the download status in the log.
+			# But it can be enabled for debugging purposes.
+			system("wget -P $config{pglist_tmp_dir} -nv $config{dump_url}") == 0
+				or die "Couldn't get archive by link: $?";
+		}
+
+		# Unzip the dump. Delete archive to save memory
+		system("gzip -d $config{pglist_archive}") == 0
+			or die "Couldn't extract archive: $?";
+
+		file_exists($path_to_dump)
+			or die "Failed to get " . $config{dump_name};
+
+		note($config{dump_name} . ' is ready to use');
+	}
+
+	$node->psql("postgres", "CREATE DATABASE pglist");
+	$node->psql("postgres", "CREATE ROLE oleg");
+	my $command = "'" . $path_to_dump . "'";
+	my $result = $node->psql("pglist", '\i ' . $command);
+}
+
+# Tests SELECT constructions to 'pglist' base
+
+sub test_select
+{
+	note("Creating index 'rumidx_orderby_sent'");
+
+	$node->safe_psql("pglist", "CREATE INDEX rumidx_orderby_sent ON pglist " .
+							   "USING rum (fts rum_tsvector_timestamp_ops, sent) " .
+							   "WITH (attach=sent, to=fts, order_by_attach=t)");
+
+	note("Test ORDER BY timestamp");
+
+	my $result1 = $node->safe_psql("pglist",
+								   "SELECT sent, subject FROM pglist WHERE fts @@ " .
+								   "to_tsquery('english', 'backend <-> crushed') " .
+								   "ORDER BY sent <=| '2016-01-01 00:01' LIMIT 5");
+
+	is($result1, '1999-06-02 11:52:46|Re: [HACKERS] PID of backend');
+
+	note("Test tsvector filter");
+
+	my $result2 = $node->safe_psql("pglist",
+								   "SELECT count(*) FROM pglist " .
+								   "WHERE fts @@ to_tsquery('english', 'tom & lane')");
+
+	is($result2, '222813');
+
+	$node->safe_psql("pglist", "DROP INDEX rumidx_orderby_sent");
+}
+
+sub test_order_by
+{
+	note("Creating index 'pglist_rum_idx'");
+
+	$node->safe_psql("pglist",
+					 "CREATE INDEX pglist_rum_idx ON pglist " .
+					 "USING rum (fts rum_tsvector_ops)");
+
+	note("Test ORDER BY tsvector");
+
+	my $result3 = $node->safe_psql("pglist",
+								   "SELECT id FROM pglist " .
+								   "WHERE fts @@ to_tsquery('english', 'postgres:*') " .
+								   "ORDER BY fts <=> " .
+								   "to_tsquery('english', 'postgres:*') LIMIT 9");
+
+	is((split(" ", $result3))[0], '816114');
+
+	# Autovacuum after large update, with active RUM index crashes postgres
+	note("Test Issue #19");
+
+	my $stderr;
+	$node->safe_psql("pglist", "DELETE FROM pglist WHERE id < 100000");
+	$node->safe_psql("pglist", "vacuum", stderr => \$stderr);
+
+	is($stderr, undef);
+
+	$node->safe_psql("pglist", "DROP INDEX pglist_rum_idx");
+}
+
+# Start backend
+
+my $pg_15_modules;
+
+BEGIN
+{
+	$pg_15_modules = eval
+	{
+		require PostgreSQL::Test::Cluster;
+		require PostgreSQL::Test::Utils;
+		return 1;
+	};
+
+	unless (defined $pg_15_modules)
+	{
+		$pg_15_modules = 0;
+
+		require PostgresNode;
+		require TestLib;
+	}
+}
+
+note('PostgreSQL 15 modules are used: ' . ($pg_15_modules ? 'yes' : 'no'));
+
+if ($pg_15_modules)
+{
+	$node = PostgreSQL::Test::Cluster->new("master");
+}
+else
+{
+	$node = PostgresNode::get_new_node("master");
+}
+
+$node->init(allows_streaming => 1);
+$node->append_conf("postgresql.conf", "shared_buffers='4GB'\n" .
+				   "maintenance_work_mem='2GB'\n" .
+				   "max_wal_size='2GB'\n" .
+				   "work_mem='50MB'");
+$node->start;
+
+# Check the existence of the pglist base
+
+note('Check the existence of the pglist base...');
+my $check_pglist = $node->psql('postgres', "SELECT count(*) FROM pg_database " .
+										   "WHERE datistemplate = false AND " .
+										   "datname = 'pglist'");
+if ($check_pglist == 1)
+{
+	note("pglist already exists");
+}
+else
+{
+	note("Create pglist database");
+	install_pglist();
+}
+
+$node->psql("pglist", "CREATE EXTENSION rum");
+note('Setup is completed successfully');
+
+eval
+{
+	test_select();
+	test_order_by();
+	$node->stop();
+	done_testing();
+	1;
+} or do {
+	note('Something went wrong: $@\n');
+};
+
diff --git a/tests/README.md b/tests/README.md
deleted file mode 100644
index 77b7d78e88..0000000000
--- a/tests/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-## Running tests
-
-Install testgres:
-
-```
-pip install testgres==0.4.0
-```
-
-Run command:
-
-```
-python -m unittest pglist_tests
-```
-
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/tests/pglist_tests.py b/tests/pglist_tests.py
deleted file mode 100644
index 7b8e4558e0..0000000000
--- a/tests/pglist_tests.py
+++ /dev/null
@@ -1,157 +0,0 @@
-# coding: utf-8
-"""
-	Test RUM index with big base 'pglist'
-
-	Copyright (c) 2015-2021, Postgres Professional
-"""
-import unittest
-import os
-import sys
-import gzip
-import testgres as tg
-
-if sys.version_info[0] < 3:
-    import urllib as request
-else:
-    import urllib.request as request
-
-from os.path import expanduser
-
-
-class PglistTests(unittest.TestCase):
-
-    def setUp(self):
-        current_dir = os.path.dirname(os.path.abspath(__file__))
-
-        self.node = tg.get_new_node("pglist",
-                                    os.path.join(current_dir, "tmp_install"))
-        try:
-            self.node.init()
-            self.node.append_conf("postgresql.conf",
-                                  "shared_buffers='4GB'\n"
-                                  "maintenance_work_mem='2GB'\n"
-                                  "max_wal_size='2GB'\n"
-                                  "work_mem='50MB'")
-            self.node.start()
-        except Exception as e:
-            self.printlog(os.path.join(self.node.logs_dir, "postgresql.log"))
-            raise e
-
-    def tearDown(self):
-        tg.stop_all()
-
-    def init_pglist_data(self, node):
-        # Check if 'pglist' base exists
-        bases = node.execute("postgres",
-                             "SELECT count(*) FROM pg_database "
-                             "WHERE datistemplate = false AND "
-                             "  datname = 'pglist'")
-        if bases[0][0] != 0:
-            return
-
-        # Check if 'pglist' dump exists
-        home = expanduser("~")
-        pglist_dump = os.path.join(home, "pglist-28-04-16.dump")
-        if not os.path.isfile(pglist_dump):
-            pglist_dumpgz = pglist_dump + ".gz"
-            if not os.path.isfile(pglist_dumpgz):
-                print("Downloading: {0}".format(pglist_dumpgz))
-                request.urlretrieve(
-                    "http://www.sai.msu.su/~megera/postgres/files/pglist-28-04-16.dump.gz",
-                    pglist_dumpgz)
-
-            print("Decompressing: {0}".format(pglist_dumpgz))
-            gz = gzip.open(pglist_dumpgz, 'rb')
-            with open(pglist_dump, 'wb') as f:
-                f.write(gz.read())
-
-            os.remove(pglist_dumpgz)
-
-        # Restore dump file
-        print("Restoring 'pglist'")
-        node.safe_psql("postgres", "CREATE DATABASE pglist")
-        node.psql("pglist", filename=pglist_dump)
-
-        node.safe_psql("pglist", "CREATE EXTENSION rum")
-
-    def printlog(self, logfile):
-        with open(logfile, 'r') as log:
-            for line in log.readlines():
-                print(line)
-
-    def test_order_by(self):
-        """Tests SELECT constructions to 'pglist' base"""
-        try:
-            self.init_pglist_data(self.node)
-
-            print("Creating index 'rumidx_orderby_sent'")
-
-            self.node.safe_psql(
-                "pglist",
-                "CREATE INDEX rumidx_orderby_sent ON pglist USING rum ("
-                "  fts rum_tsvector_timestamp_ops, sent) "
-                "  WITH (attach=sent, to=fts, order_by_attach=t)")
-
-            print("Running tests")
-
-            self.assertEqual(
-                self.node.safe_psql(
-                    "pglist",
-                    "SELECT sent, subject "
-                    "  FROM pglist "
-                    "  WHERE fts @@ "
-                    "    to_tsquery('english', 'backend <-> crushed') "
-                    "  ORDER BY sent <=| '2016-01-01 00:01' LIMIT 5"
-                ),
-                b'1999-06-02 11:52:46|Re: [HACKERS] PID of backend\n'
-            )
-
-            self.assertEqual(
-                self.node.safe_psql(
-                    "pglist",
-                    "SELECT count(*) FROM pglist "
-                    "WHERE fts @@ to_tsquery('english', 'tom & lane')"
-                ),
-                b'222813\n'
-            )
-
-            self.node.safe_psql("pglist", "DROP INDEX rumidx_orderby_sent");
-
-            print("Creating index 'pglist_rum_idx'")
-
-            self.node.safe_psql(
-                "pglist",
-                "CREATE INDEX pglist_rum_idx ON pglist USING rum ("
-                "  fts rum_tsvector_ops)")
-
-            print("Running tests")
-
-            self.assertEqual(
-                self.node.execute(
-                    "pglist",
-                    "SELECT id FROM pglist "
-                    "WHERE fts @@ to_tsquery('english', 'postgres:*') "
-                    "ORDER BY fts <=> to_tsquery('english', 'postgres:*') "
-                    "LIMIT 9"
-                )[0][0],
-                816114
-            )
-
-            # Autovacuum after large update, with active RUM index crashes postgres
-            print("Test Issue #19")
-
-            self.node.safe_psql(
-                "pglist",
-                "DELETE FROM pglist WHERE id < 100000")
-            self.node.safe_psql(
-                "pglist",
-                "vacuum")
-
-            self.node.safe_psql("pglist", "DROP INDEX pglist_rum_idx");
-
-        except Exception as e:
-            self.printlog(os.path.join(self.node.logs_dir, "postgresql.log"))
-            raise e
-
-if __name__ == "__main__":
-    unittest.main()
diff --git a/travis/run_tests.sh b/travis/run_tests.sh
index aaebf3f200..37bba84d64 100644
--- a/travis/run_tests.sh
+++ b/travis/run_tests.sh
@@ -38,6 +38,7 @@ if [ "$LEVEL" = "hardcore" ]; then
 	./configure \
 		CFLAGS='-fno-omit-frame-pointer' \
 		--enable-cassert \
+		--enable-tap-tests \
 		--prefix=$CUSTOM_PG_BIN \
 		--quiet
 

From 36379d3b54ca1870e0a7f93758e59f23dbf23349 Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Wed, 11 Dec 2024 19:12:03 +0300
Subject: [PATCH 27/35] Update alternative output for 32-bit systems.

Commit 34619f96302f changed orderby.sql and orderby.out.
But this test has alternative output orderby_1.sql for
32-bit systems. Fix comments for files with alternatives.
---
 expected/array.out     | 13 ++++++-------
 expected/array_1.out   | 13 ++++++-------
 expected/orderby.out   |  9 +++++++++
 expected/orderby_1.out | 14 ++++++++++++++
 sql/array.sql          | 13 ++++++-------
 sql/orderby.sql        | 11 +++++++++++
 6 files changed, 52 insertions(+), 21 deletions(-)

diff --git a/expected/array.out b/expected/array.out
index 1e45885ad1..a2fb3bb8df 100644
--- a/expected/array.out
+++ b/expected/array.out
@@ -1,12 +1,11 @@
 /*
- * ---------------------------------------------
- *  NOTE: This test behaves differenly on PgPro
- * ---------------------------------------------
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * array.out - test output for 64-bit systems and
+ * array_1.out - test output for 32-bit systems.
  *
- * --------------------
- *  array.sql and array_1.sql
- * --------------------
- * Test output for 64-bit and 32-bit systems respectively.
  */
 set enable_seqscan=off;
 set enable_sort=off;
diff --git a/expected/array_1.out b/expected/array_1.out
index c0876801bc..cc5f93307c 100644
--- a/expected/array_1.out
+++ b/expected/array_1.out
@@ -1,12 +1,11 @@
 /*
- * ---------------------------------------------
- *  NOTE: This test behaves differenly on PgPro
- * ---------------------------------------------
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * array.out - test output for 64-bit systems and
+ * array_1.out - test output for 32-bit systems.
  *
- * --------------------
- *  array.sql and array_1.sql
- * --------------------
- * Test output for 64-bit and 32-bit systems respectively.
  */
 set enable_seqscan=off;
 set enable_sort=off;
diff --git a/expected/orderby.out b/expected/orderby.out
index 0f8a5454ef..07ae7322ed 100644
--- a/expected/orderby.out
+++ b/expected/orderby.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * orderby.out - test output for 64-bit systems and
+ * orderby_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE tsts (id int, t tsvector, d timestamp);
 \copy tsts from 'data/tsts.data'
 CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d)
diff --git a/expected/orderby_1.out b/expected/orderby_1.out
index a6fb68c1e3..cdd536ac9d 100644
--- a/expected/orderby_1.out
+++ b/expected/orderby_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * orderby.out - test output for 64-bit systems and
+ * orderby_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE tsts (id int, t tsvector, d timestamp);
 \copy tsts from 'data/tsts.data'
 CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d)
@@ -420,6 +429,11 @@ SELECT id, d FROM tsts WHERE  t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER
  458 | Fri May 20 21:21:22.326724 2016
 (3 rows)
 
+-- Test "ORDER BY" error message
+DROP INDEX tsts_idx;
+CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d);
+SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5;
+ERROR:  doesn't support order by over pass-by-reference column
 -- Test multicolumn index
 RESET enable_indexscan;
 RESET enable_indexonlyscan;
diff --git a/sql/array.sql b/sql/array.sql
index ba6886780d..9eba800bcf 100644
--- a/sql/array.sql
+++ b/sql/array.sql
@@ -1,12 +1,11 @@
 /*
- * ---------------------------------------------
- *  NOTE: This test behaves differenly on PgPro
- * ---------------------------------------------
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * array.out - test output for 64-bit systems and
+ * array_1.out - test output for 32-bit systems.
  *
- * --------------------
- *  array.sql and array_1.sql
- * --------------------
- * Test output for 64-bit and 32-bit systems respectively.
  */
 
 
diff --git a/sql/orderby.sql b/sql/orderby.sql
index 4c2689d193..a2bd227873 100644
--- a/sql/orderby.sql
+++ b/sql/orderby.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * orderby.out - test output for 64-bit systems and
+ * orderby_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 CREATE TABLE tsts (id int, t tsvector, d timestamp);
 
 \copy tsts from 'data/tsts.data'

From 02a8d77cea827142a2c42c2679ab2ddbf53170b5 Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Wed, 11 Dec 2024 19:36:13 +0300
Subject: [PATCH 28/35] Add comments about alternative outputs.

This comments should remind us to change the output for 32-bit
systems at the same time as the tests and 64-bit outputs.
---
 expected/altorder.out        |  9 +++++++++
 expected/altorder_1.out      |  9 +++++++++
 expected/altorder_hash.out   |  9 +++++++++
 expected/altorder_hash_1.out |  9 +++++++++
 expected/float8.out          |  9 +++++++++
 expected/float8_1.out        |  9 +++++++++
 expected/int8.out            |  9 +++++++++
 expected/int8_1.out          |  9 +++++++++
 expected/money.out           |  9 +++++++++
 expected/money_1.out         |  9 +++++++++
 expected/orderby_hash.out    |  9 +++++++++
 expected/orderby_hash_1.out  |  9 +++++++++
 expected/timestamp.out       |  9 +++++++++
 expected/timestamp_1.out     |  9 +++++++++
 sql/altorder.sql             | 11 +++++++++++
 sql/altorder_hash.sql        | 11 +++++++++++
 sql/float8.sql               | 11 +++++++++++
 sql/int8.sql                 | 11 +++++++++++
 sql/money.sql                | 11 +++++++++++
 sql/orderby_hash.sql         | 11 +++++++++++
 sql/timestamp.sql            | 10 ++++++++++
 21 files changed, 202 insertions(+)

diff --git a/expected/altorder.out b/expected/altorder.out
index dcf5a51954..6c0bcae2ad 100644
--- a/expected/altorder.out
+++ b/expected/altorder.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * altorder.out - test output for 64-bit systems and
+ * altorder_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE atsts (id int, t tsvector, d timestamp);
 \copy atsts from 'data/tsts.data'
 -- PGPRO-2537: We need more data to test rumsort.c with logtape.c
diff --git a/expected/altorder_1.out b/expected/altorder_1.out
index 2fb7f52326..980515f58e 100644
--- a/expected/altorder_1.out
+++ b/expected/altorder_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * altorder.out - test output for 64-bit systems and
+ * altorder_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE atsts (id int, t tsvector, d timestamp);
 \copy atsts from 'data/tsts.data'
 -- PGPRO-2537: We need more data to test rumsort.c with logtape.c
diff --git a/expected/altorder_hash.out b/expected/altorder_hash.out
index 125c195be9..1011b90d0c 100644
--- a/expected/altorder_hash.out
+++ b/expected/altorder_hash.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * altorder_hash.out - test output for 64-bit systems and
+ * altorder_hash_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE atstsh (id int, t tsvector, d timestamp);
 \copy atstsh from 'data/tsts.data'
 CREATE INDEX atstsh_idx ON atstsh USING rum (t rum_tsvector_hash_addon_ops, d)
diff --git a/expected/altorder_hash_1.out b/expected/altorder_hash_1.out
index 2d93f3f5eb..e310fbdb89 100644
--- a/expected/altorder_hash_1.out
+++ b/expected/altorder_hash_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * altorder_hash.out - test output for 64-bit systems and
+ * altorder_hash_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE atstsh (id int, t tsvector, d timestamp);
 \copy atstsh from 'data/tsts.data'
 CREATE INDEX atstsh_idx ON atstsh USING rum (t rum_tsvector_hash_addon_ops, d)
diff --git a/expected/float8.out b/expected/float8.out
index e96cb0ea54..fdca51343a 100644
--- a/expected/float8.out
+++ b/expected/float8.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * float8.out - test output for 64-bit systems and
+ * float8_1.out - test output for 32-bit systems.
+ *
+ */
 set enable_seqscan=off;
 CREATE TABLE test_float8 (
 	i float8
diff --git a/expected/float8_1.out b/expected/float8_1.out
index dabdd51964..b421dcf311 100644
--- a/expected/float8_1.out
+++ b/expected/float8_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * float8.out - test output for 64-bit systems and
+ * float8_1.out - test output for 32-bit systems.
+ *
+ */
 set enable_seqscan=off;
 CREATE TABLE test_float8 (
 	i float8
diff --git a/expected/int8.out b/expected/int8.out
index 62e4f80a37..663162a18e 100644
--- a/expected/int8.out
+++ b/expected/int8.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * int8.out - test output for 64-bit systems and
+ * int8_1.out - test output for 32-bit systems.
+ *
+ */
 set enable_seqscan=off;
 CREATE TABLE test_int8 (
 	i int8
diff --git a/expected/int8_1.out b/expected/int8_1.out
index cbf68dff13..ffced0aaf8 100644
--- a/expected/int8_1.out
+++ b/expected/int8_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * int8.out - test output for 64-bit systems and
+ * int8_1.out - test output for 32-bit systems.
+ *
+ */
 set enable_seqscan=off;
 CREATE TABLE test_int8 (
 	i int8
diff --git a/expected/money.out b/expected/money.out
index 7b9b20580e..b2e9bac41d 100644
--- a/expected/money.out
+++ b/expected/money.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * money.out - test output for 64-bit systems and
+ * money_1.out - test output for 32-bit systems.
+ *
+ */
 set enable_seqscan=off;
 CREATE TABLE test_money (
 	i money
diff --git a/expected/money_1.out b/expected/money_1.out
index b8ec0ec5c7..6a3fa8c211 100644
--- a/expected/money_1.out
+++ b/expected/money_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * money.out - test output for 64-bit systems and
+ * money_1.out - test output for 32-bit systems.
+ *
+ */
 set enable_seqscan=off;
 CREATE TABLE test_money (
 	i money
diff --git a/expected/orderby_hash.out b/expected/orderby_hash.out
index 7ff1794c5f..782ad5700e 100644
--- a/expected/orderby_hash.out
+++ b/expected/orderby_hash.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * orderby_hash.out - test output for 64-bit systems and
+ * orderby_hash_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE tstsh (id int, t tsvector, d timestamp);
 \copy tstsh from 'data/tsts.data'
 CREATE INDEX tstsh_idx ON tstsh USING rum (t rum_tsvector_hash_addon_ops, d)
diff --git a/expected/orderby_hash_1.out b/expected/orderby_hash_1.out
index f32267631c..f19e4507c7 100644
--- a/expected/orderby_hash_1.out
+++ b/expected/orderby_hash_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * orderby_hash.out - test output for 64-bit systems and
+ * orderby_hash_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE tstsh (id int, t tsvector, d timestamp);
 \copy tstsh from 'data/tsts.data'
 CREATE INDEX tstsh_idx ON tstsh USING rum (t rum_tsvector_hash_addon_ops, d)
diff --git a/expected/timestamp.out b/expected/timestamp.out
index 37f26f073f..00969a7534 100644
--- a/expected/timestamp.out
+++ b/expected/timestamp.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * timestamp.out - test output for 64-bit systems and
+ * timestamp_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE test_timestamp (
 	i timestamp
 );
diff --git a/expected/timestamp_1.out b/expected/timestamp_1.out
index e15bcc7584..a8641a3232 100644
--- a/expected/timestamp_1.out
+++ b/expected/timestamp_1.out
@@ -1,3 +1,12 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * timestamp.out - test output for 64-bit systems and
+ * timestamp_1.out - test output for 32-bit systems.
+ *
+ */
 CREATE TABLE test_timestamp (
 	i timestamp
 );
diff --git a/sql/altorder.sql b/sql/altorder.sql
index bc89f8fc06..850e252325 100644
--- a/sql/altorder.sql
+++ b/sql/altorder.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * altorder.out - test output for 64-bit systems and
+ * altorder_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 CREATE TABLE atsts (id int, t tsvector, d timestamp);
 
 \copy atsts from 'data/tsts.data'
diff --git a/sql/altorder_hash.sql b/sql/altorder_hash.sql
index 3b723876f9..148407c661 100644
--- a/sql/altorder_hash.sql
+++ b/sql/altorder_hash.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * altorder_hash.out - test output for 64-bit systems and
+ * altorder_hash_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 CREATE TABLE atstsh (id int, t tsvector, d timestamp);
 
 \copy atstsh from 'data/tsts.data'
diff --git a/sql/float8.sql b/sql/float8.sql
index 2de5b9ea19..b61cbfb0da 100644
--- a/sql/float8.sql
+++ b/sql/float8.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * float8.out - test output for 64-bit systems and
+ * float8_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 set enable_seqscan=off;
 
 CREATE TABLE test_float8 (
diff --git a/sql/int8.sql b/sql/int8.sql
index 4ec9bf0abf..c51705e62b 100644
--- a/sql/int8.sql
+++ b/sql/int8.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * int8.out - test output for 64-bit systems and
+ * int8_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 set enable_seqscan=off;
 
 CREATE TABLE test_int8 (
diff --git a/sql/money.sql b/sql/money.sql
index 952d2bc8fe..13df5ed260 100644
--- a/sql/money.sql
+++ b/sql/money.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * money.out - test output for 64-bit systems and
+ * money_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 set enable_seqscan=off;
 
 CREATE TABLE test_money (
diff --git a/sql/orderby_hash.sql b/sql/orderby_hash.sql
index f7e9808538..dba8f17ca1 100644
--- a/sql/orderby_hash.sql
+++ b/sql/orderby_hash.sql
@@ -1,3 +1,14 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * orderby_hash.out - test output for 64-bit systems and
+ * orderby_hash_1.out - test output for 32-bit systems.
+ *
+ */
+
+
 CREATE TABLE tstsh (id int, t tsvector, d timestamp);
 
 \copy tstsh from 'data/tsts.data'
diff --git a/sql/timestamp.sql b/sql/timestamp.sql
index 8025774b82..3386229ddc 100644
--- a/sql/timestamp.sql
+++ b/sql/timestamp.sql
@@ -1,3 +1,13 @@
+/*
+ * ------------------------------------
+ *  NOTE: This test behaves differenly
+ * ------------------------------------
+ *
+ * timestamp.out - test output for 64-bit systems and
+ * timestamp_1.out - test output for 32-bit systems.
+ *
+ */
+
 
 CREATE TABLE test_timestamp (
 	i timestamp

From 9e70afeba5c105242f9000ae50b680e6024e5d23 Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Tue, 17 Dec 2024 15:01:24 +0300
Subject: [PATCH 29/35] Tidying up update scripts.

1) remove perl scripts for generating sql files,
2) revert saving of old versions of init files,
3) clean Makefile
---
 Makefile                     |   25 +-
 gen_rum_sql--1.0--1.1.pl     |  335 -------
 gen_rum_sql--1.1--1.2.pl     |  183 ----
 rum--1.0.sql                 |  411 --------
 rum--1.1.sql                 | 1513 ------------------------------
 rum--1.2.sql                 | 1707 ----------------------------------
 rum--1.3.sql => rum_init.sql |    0
 7 files changed, 7 insertions(+), 4167 deletions(-)
 delete mode 100644 gen_rum_sql--1.0--1.1.pl
 delete mode 100644 gen_rum_sql--1.1--1.2.pl
 delete mode 100644 rum--1.0.sql
 delete mode 100644 rum--1.1.sql
 delete mode 100644 rum--1.2.sql
 rename rum--1.3.sql => rum_init.sql (100%)

diff --git a/Makefile b/Makefile
index ab4ee1df38..cca576da85 100644
--- a/Makefile
+++ b/Makefile
@@ -11,14 +11,10 @@ OBJS = src/rumsort.o src/rum_ts_utils.o src/rumtsquery.o \
 	src/rumscan.o src/rumutil.o src/rumvacuum.o src/rumvalidate.o \
 	src/btree_rum.o src/rum_arr_utils.o $(WIN32RES)
 
-DATA_first = rum--1.0.sql
 DATA_updates = rum--1.0--1.1.sql rum--1.1--1.2.sql \
 			   rum--1.2--1.3.sql
 
-DATA = $(DATA_first) rum--$(EXTVERSION).sql $(DATA_updates)
-
-# Do not use DATA_built. It removes built files if clean target was used
-SQL_built = rum--$(EXTVERSION).sql $(DATA_updates)
+DATA_built = $(EXTENSION)--$(EXTVERSION).sql
 
 INCLUDES = rum.h rumsort.h
 RELATIVE_INCLUDES = $(addprefix src/, $(INCLUDES))
@@ -28,8 +24,8 @@ LDFLAGS_SL += $(filter -lm, $(LIBS))
 REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_hash \
 	altorder altorder_hash limits \
 	int2 int4 int8 float4 float8 money oid \
-    time timetz date interval \
-    macaddr inet cidr text varchar char bytea bit varbit \
+	time timetz date interval \
+	macaddr inet cidr text varchar char bytea bit varbit \
 	numeric rum_weight expr
 
 TAP_TESTS = 1
@@ -47,6 +43,9 @@ include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
 
+$(EXTENSION)--$(EXTVERSION).sql: rum_init.sql
+	cat $^ > $@
+
 ifeq ($(MAJORVERSION), 9.6)
 # arrays are not supported on 9.6
 else
@@ -61,16 +60,6 @@ wal-check: temp-install
 check: wal-check
 endif
 
-all: $(SQL_built)
-
-#9.6 requires 1.3 file but 10.0 could live with update files
-rum--$(EXTVERSION).sql: $(DATA_first) $(DATA_updates)
-	cat $(DATA_first) $(DATA_updates) > rum--$(EXTVERSION).sql
-
-# rule for updates, e.g. rum--1.0--1.1.sql
-rum--%.sql: gen_rum_sql--%.pl
-	perl $< > $@
-
 install: installincludes
 
 installincludes:
@@ -92,5 +81,5 @@ submake-rum:
 
 isolationcheck: | submake-isolation submake-rum temp-install
 	$(pg_isolation_regress_check) \
-	    --temp-config $(top_srcdir)/contrib/rum/logical.conf \
+		--temp-config $(top_srcdir)/contrib/rum/logical.conf \
 		$(ISOLATIONCHECKS)
diff --git a/gen_rum_sql--1.0--1.1.pl b/gen_rum_sql--1.0--1.1.pl
deleted file mode 100644
index 7296f6c023..0000000000
--- a/gen_rum_sql--1.0--1.1.pl
+++ /dev/null
@@ -1,335 +0,0 @@
-use strict;
-use warnings;
-
-my $func_base_template=<<EOT;
-CREATE FUNCTION rum_TYPEIDENT_extract_value(TYPENAME, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_TYPEIDENT_compare_prefix(TYPENAME, TYPENAME, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_TYPEIDENT_extract_query(TYPENAME, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-EOT
-
-my $func_distance_template=<<EOT;
-$func_base_template
-
-CREATE FUNCTION rum_TYPEIDENT_distance(TYPENAME, TYPENAME)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_TYPEIDENT_distance,
-	LEFTARG = TYPENAME,
-	RIGHTARG = TYPENAME,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_TYPEIDENT_left_distance(TYPENAME, TYPENAME)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_TYPEIDENT_left_distance,
-	LEFTARG = TYPENAME,
-	RIGHTARG = TYPENAME,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_TYPEIDENT_right_distance(TYPENAME, TYPENAME)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_TYPEIDENT_right_distance,
-	LEFTARG = TYPENAME,
-	RIGHTARG = TYPENAME,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_TYPEIDENT_outer_distance(TYPENAME, TYPENAME, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_TYPEIDENT_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-EOT
-
-my $opclass_base_template=<<EOT;
-
-CREATE OPERATOR CLASS rum_TYPEIDENT_ops
-DEFAULT FOR TYPE TYPENAME USING rum
-AS
-	OPERATOR	1	  <		TYPESOPARG,
-	OPERATOR	2	  <=	TYPESOPARG,
-	OPERATOR	3	  =		TYPESOPARG,
-	OPERATOR	4	  >=	TYPESOPARG,
-	OPERATOR	5	  >		TYPESOPARG,
-	FUNCTION	1	  TYPECMPFUNC(TYPECMPTYPE,TYPECMPTYPE),
-	FUNCTION	2	  rum_TYPESUBIDENT_extract_value(TYPESUBNAME, internal),
-	FUNCTION	3	  rum_TYPESUBIDENT_extract_query(TYPESUBNAME, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_TYPESUBIDENT_compare_prefix(TYPESUBNAME,TYPESUBNAME,int2, internal),
-STORAGE		 TYPENAME;
-
-EOT
-
-my $opclass_distance_template=<<EOT;
-
-CREATE OPERATOR CLASS rum_TYPEIDENT_ops
-DEFAULT FOR TYPE TYPENAME USING rum
-AS
-	OPERATOR	1	<	TYPESOPARG,
-	OPERATOR	2	<=	TYPESOPARG,
-	OPERATOR	3	=	TYPESOPARG,
-	OPERATOR	4	>=	TYPESOPARG,
-	OPERATOR	5	>	TYPESOPARG,
-	OPERATOR	20	<=> (TYPENAME,TYPENAME) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (TYPENAME,TYPENAME) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (TYPENAME,TYPENAME) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	TYPECMPFUNC(TYPECMPTYPE,TYPECMPTYPE),
-	FUNCTION	2	rum_TYPESUBIDENT_extract_value(TYPESUBNAME, internal),
-	FUNCTION	3	rum_TYPESUBIDENT_extract_query(TYPESUBNAME, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_TYPESUBIDENT_compare_prefix(TYPESUBNAME,TYPESUBNAME,int2, internal),
-	-- support to TYPEIDENT distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_TYPEIDENT_config(internal),
-	FUNCTION	9	rum_TYPEIDENT_outer_distance(TYPENAME, TYPENAME, smallint),
-STORAGE		 TYPENAME;
-
-EOT
-
-my @opinfo = map {
-		$_->{TYPEIDENT}   = $_->{TYPENAME} if ! exists $_->{TYPEIDENT};
-		$_->{TYPECMPTYPE} = $_->{TYPENAME} if !exists $_->{TYPECMPTYPE};
-		$_->{TYPESUBNAME} = $_->{TYPENAME} if !exists $_->{TYPESUBNAME};
-		$_->{TYPESUBIDENT}= $_->{TYPEIDENT} if ! exists $_->{TYPESUBIDENT};
-		$_->{TYPESOPARG}= '' if ! exists $_->{TYPESOPARG};
-		$_
-	} (
-	# timestamp/tz aren't here: they are in rum--1.0.sql
-
-	{
-		TYPENAME	=>	'int2',
-		TYPECMPFUNC	=>	'btint2cmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'int4',
-		TYPECMPFUNC	=>	'btint4cmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'int8',
-		TYPECMPFUNC	=>	'btint8cmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'float4',
-		TYPECMPFUNC	=>	'btfloat4cmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'float8',
-		TYPECMPFUNC	=>	'btfloat8cmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'money',
-		TYPECMPFUNC	=>	'cash_cmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'oid',
-		TYPECMPFUNC	=>	'btoidcmp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'time',
-		TYPECMPFUNC	=>	'time_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'timetz',
-		TYPECMPFUNC	=>	'timetz_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'date',
-		TYPECMPFUNC	=>	'date_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'interval',
-		TYPECMPFUNC	=>	'interval_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'macaddr',
-		TYPECMPFUNC	=>	'macaddr_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'inet',
-		TYPECMPFUNC	=>	'network_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'cidr',
-		TYPECMPFUNC	=>	'network_cmp',
-		TYPECMPTYPE	=>	'inet',
-		TYPESOPARG	=>	'(inet, inet)',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'text',
-		TYPECMPFUNC	=>	'bttextcmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'varchar',
-		TYPECMPFUNC	=>	'bttextcmp',
-		TYPECMPTYPE	=>	'text',
-		TYPESUBIDENT=>	'text',
-		TYPESUBNAME =>	'text',
-		TYPESOPARG	=>	'(text, text)',
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'"char"',
-		TYPEIDENT	=>	'char',
-		TYPECMPFUNC	=>	'btcharcmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'bytea',
-		TYPECMPFUNC	=>	'byteacmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'bit',
-		TYPECMPFUNC	=>	'bitcmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'varbit',
-		TYPECMPFUNC	=>	'varbitcmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-	{
-		TYPENAME	=>	'numeric',
-		TYPECMPFUNC	=>	'rum_numeric_cmp',
-		func_tmpl	=>	\$func_base_template,
-		opclass_tmpl=>	\$opclass_base_template,
-	},
-);
-
-##############Generate!!!
-
-print <<EOT;
-/*
- * RUM version 1.1
- */
- 
-CREATE FUNCTION rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-ALTER FUNCTION
-	rum_tsquery_timestamp_consistent (internal,smallint,tsvector,int,internal,internal,internal,internal)
-	RENAME TO rum_tsquery_addon_consistent;
-
-CREATE FUNCTION rum_numeric_cmp(numeric, numeric)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE OPERATOR CLASS rum_tsvector_addon_ops
-FOR TYPE tsvector USING rum
-AS
-	OPERATOR	1	@@ (tsvector, tsquery),
-	--support function
-	FUNCTION	1	gin_cmp_tslexeme(text, text),
-	FUNCTION	2	rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_tsquery_addon_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	FUNCTION	5	gin_cmp_prefix(text,text,smallint,internal),
-	FUNCTION	7	rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	STORAGE	 text;
-
-CREATE OPERATOR CLASS rum_tsvector_hash_addon_ops
-FOR TYPE tsvector USING rum
-AS
-	OPERATOR	1	@@ (tsvector, tsquery),
-	--support function
-	FUNCTION	1	btint4cmp(integer, integer),
-	FUNCTION	2	rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_tsquery_addon_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	FUNCTION	7	rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	STORAGE	 integer;
-
-EOT
-
-foreach my $t (@opinfo)
-{
-	print	"/*--------------------$t->{TYPENAME}-----------------------*/\n\n";
-
-	for my $v (qw(func_tmpl opclass_tmpl))
-	{
-		next if !exists $t->{$v};
-
-		my $x = ${$t->{$v}};
-
-		for my $k (grep {uc($_) eq $_} keys %$t)
-		{
-			$x=~s/$k/$t->{$k}/g;
-		}
-
-		print $x;
-	}
-}
-
-# Drop doesn't work
-#print <<EOT;
-#ALTER OPERATOR FAMILY rum_timestamp_ops USING rum DROP FUNCTION 4
-#	(timestamp, timestamp); -- strange definition
-#ALTER OPERATOR FAMILY rum_timestamp_ops USING rum ADD  FUNCTION 4
-#	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal);
-#EOT
diff --git a/gen_rum_sql--1.1--1.2.pl b/gen_rum_sql--1.1--1.2.pl
deleted file mode 100644
index e8309dc367..0000000000
--- a/gen_rum_sql--1.1--1.2.pl
+++ /dev/null
@@ -1,183 +0,0 @@
-use strict;
-use warnings;
-
-my $func_distance_template=<<EOT;
-CREATE FUNCTION rum_TYPEIDENT_key_distance(TYPENAME, TYPENAME, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-EOT
-
-my $opclass_distance_template=<<EOT;
-
-ALTER OPERATOR FAMILY rum_TYPEIDENT_ops USING rum ADD
-	FUNCTION	8	(TYPENAME,TYPENAME) rum_TYPEIDENT_key_distance(TYPENAME, TYPENAME, smallint);
-
-EOT
-
-my @opinfo = map {
-		$_->{TYPEIDENT}   = $_->{TYPENAME} if !exists $_->{TYPEIDENT};
-		$_
-	} (
-	{
-		TYPENAME	=>	'int2',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'int4',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'int8',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'float4',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'float8',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'money',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'oid',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'timestamp',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-	{
-		TYPENAME	=>	'timestamptz',
-		func_tmpl	=>	\$func_distance_template,
-		opclass_tmpl=>	\$opclass_distance_template,
-	},
-);
-
-##############Generate!!!
-
-print <<EOT;
-/*
- * RUM version 1.2
- */
-
-/*--------------------anyarray-----------------------*/
-
-CREATE FUNCTION rum_anyarray_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT STABLE;
-
-CREATE OPERATOR % (
-	PROCEDURE = rum_anyarray_similar,
-	LEFTARG = anyarray,
-	RIGHTARG = anyarray,
-	COMMUTATOR = '%',
-	RESTRICT = contsel,
-	JOIN = contjoinsel
-);
-
-
-CREATE FUNCTION rum_anyarray_distance(anyarray,anyarray)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT STABLE;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_anyarray_distance,
-	LEFTARG = anyarray,
-	RIGHTARG = anyarray,
-	COMMUTATOR = '<=>'
-);
-
-
-CREATE FUNCTION rum_extract_anyarray(anyarray,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_anyarray_query(anyarray,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_anyarray_consistent(internal, smallint, anyarray, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_anyarray_ordering(internal,smallint,anyarray,int,internal,internal,internal,internal,internal)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-CREATE OPERATOR CLASS rum_anyarray_ops
-DEFAULT FOR TYPE anyarray USING rum
-AS
-	OPERATOR	1	&&  (anyarray, anyarray),
-	OPERATOR	2	@>  (anyarray, anyarray),
-	OPERATOR	3	<@  (anyarray, anyarray),
-	OPERATOR	4	=   (anyarray, anyarray),
-	OPERATOR	5	%   (anyarray, anyarray),
-	OPERATOR	20	<=> (anyarray, anyarray) FOR ORDER BY pg_catalog.float_ops,
-	--dispatch function 1 for concrete type
-	FUNCTION	2	rum_extract_anyarray(anyarray,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_anyarray_query(anyarray,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_anyarray_consistent(internal,smallint,anyarray,integer,internal,internal,internal,internal),
-	FUNCTION	6	rum_anyarray_config(internal),
-	FUNCTION	8	rum_anyarray_ordering(internal,smallint,anyarray,int,internal,internal,internal,internal,internal),
-	STORAGE anyelement;
-
-CREATE OPERATOR CLASS rum_anyarray_addon_ops
-FOR TYPE anyarray USING rum
-AS
-	OPERATOR	1	&& (anyarray, anyarray),
-	OPERATOR	2	@> (anyarray, anyarray),
-	OPERATOR	3	<@ (anyarray, anyarray),
-	OPERATOR	4	=  (anyarray, anyarray),
-	--dispatch function 1 for concrete type
-	FUNCTION	2	ginarrayextract(anyarray,internal,internal),
-	FUNCTION	3	ginqueryarrayextract(anyarray,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	ginarrayconsistent(internal,smallint,anyarray,integer,internal,internal,internal,internal),
-	STORAGE anyelement;
-
-EOT
-
-foreach my $t (@opinfo)
-{
-	print	"/*--------------------$t->{TYPENAME}-----------------------*/\n\n";
-
-	for my $v (qw(func_tmpl opclass_tmpl))
-	{
-		next if !exists $t->{$v};
-
-		my $x = ${$t->{$v}};
-
-		for my $k (grep {uc($_) eq $_} keys %$t)
-		{
-			$x=~s/$k/$t->{$k}/g;
-		}
-
-		print $x;
-	}
-}
diff --git a/rum--1.0.sql b/rum--1.0.sql
deleted file mode 100644
index fd2616b204..0000000000
--- a/rum--1.0.sql
+++ /dev/null
@@ -1,411 +0,0 @@
-CREATE FUNCTION rumhandler(internal)
-RETURNS index_am_handler
-AS 'MODULE_PATHNAME'
-LANGUAGE C;
-
-/*
- * RUM access method
- */
-
-CREATE ACCESS METHOD rum TYPE INDEX HANDLER rumhandler;
-
-/*
- * RUM built-in types, operators and functions
- */
-
--- Type used in distance calculations with normalization argument
-CREATE TYPE rum_distance_query AS (query tsquery, method int);
-
-CREATE FUNCTION tsquery_to_distance_query(tsquery)
-RETURNS rum_distance_query
-AS 'MODULE_PATHNAME', 'tsquery_to_distance_query'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE CAST (tsquery AS rum_distance_query)
-        WITH FUNCTION tsquery_to_distance_query(tsquery) AS IMPLICIT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,tsquery)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_tt'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,tsquery,int)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_ttf'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,rum_distance_query)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_td'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        LEFTARG = tsvector,
-        RIGHTARG = tsquery,
-        PROCEDURE = rum_ts_distance
-);
-
-CREATE OPERATOR <=> (
-        LEFTARG = tsvector,
-        RIGHTARG = rum_distance_query,
-        PROCEDURE = rum_ts_distance
-);
-
-CREATE FUNCTION rum_timestamp_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        PROCEDURE = rum_timestamp_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_timestamp_left_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-        PROCEDURE = rum_timestamp_left_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_timestamp_right_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-        PROCEDURE = rum_timestamp_right_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = <=|
-);
-
-/*
- * rum_tsvector_ops operator class
- */
-
-CREATE FUNCTION rum_extract_tsvector(tsvector,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsvector_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
--- To prevent calling from SQL
-CREATE FUNCTION rum_ts_join_pos(internal, internal)
-RETURNS bytea
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsvector_ops
-DEFAULT FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        OPERATOR        2       <=> (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        6       rum_tsvector_config(internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        8       rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal),
-        FUNCTION        10      rum_ts_join_pos(internal, internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_ops operator class.
- *
- * Stores hash of entries as keys in index.
- */
-
-CREATE FUNCTION rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsvector_hash_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        OPERATOR        2       <=> (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        6       rum_tsvector_config(internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        8       rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal),
-        FUNCTION        10      rum_ts_join_pos(internal, internal),
-        STORAGE         integer;
-
-/*
- * rum_timestamp_ops operator class
- */
-
--- timestamp operator class
-
-CREATE FUNCTION rum_timestamp_extract_value(timestamp,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_outer_distance(timestamp, timestamp, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE OPERATOR CLASS rum_timestamp_ops
-DEFAULT FOR TYPE timestamp USING rum
-AS
-        OPERATOR        1       <,
-        OPERATOR        2       <=,
-        OPERATOR        3       =,
-        OPERATOR        4       >=,
-        OPERATOR        5       >,
-        --support
-        FUNCTION        1       timestamp_cmp(timestamp,timestamp),
-        FUNCTION        2       rum_timestamp_extract_value(timestamp,internal,internal,internal,internal),
-        FUNCTION        3       rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
-        FUNCTION        5       rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
-        FUNCTION        6       rum_timestamp_config(internal),
-        -- support to timestamp distance in rum_tsvector_timestamp_ops
-        FUNCTION        9       rum_timestamp_outer_distance(timestamp, timestamp, smallint),
-        OPERATOR        20      <=> (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        21      <=| (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        22      |=> (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-STORAGE         timestamp;
-
-/*
- * rum_tsvector_timestamp_ops operator class.
- *
- * Stores timestamp with tsvector.
- */
-
-CREATE FUNCTION rum_tsquery_timestamp_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-/*
- *	!!!deprecated, use rum_tsvector_addon_ops!!!
- */
-CREATE OPERATOR CLASS rum_tsvector_timestamp_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_timestamp_ops operator class
- *	!!!deprecated, use rum_tsvector_hash_addon_ops!!!
- */
-
-CREATE OPERATOR CLASS rum_tsvector_hash_timestamp_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         integer;
-
-/*
- * rum_timestamptz_ops operator class
- */
-
-CREATE FUNCTION rum_timestamptz_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        PROCEDURE = rum_timestamptz_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_timestamptz_left_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_left_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-        PROCEDURE = rum_timestamptz_left_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_timestamptz_right_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_right_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-        PROCEDURE = rum_timestamptz_right_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = <=|
-);
-
-CREATE OPERATOR CLASS rum_timestamptz_ops
-DEFAULT FOR TYPE timestamptz USING rum
-AS
-        OPERATOR        1       <,
-        OPERATOR        2       <=,
-        OPERATOR        3       =,
-        OPERATOR        4       >=,
-        OPERATOR        5       >,
-        --support
-        FUNCTION        1       timestamptz_cmp(timestamptz,timestamptz),
-        FUNCTION        2       rum_timestamp_extract_value(timestamp,internal,internal,internal,internal),
-        FUNCTION        3       rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
-        FUNCTION        5       rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
-        FUNCTION        6       rum_timestamp_config(internal),
-        -- support to timestamptz distance in rum_tsvector_timestamptz_ops
-        FUNCTION        9       rum_timestamp_outer_distance(timestamp, timestamp, smallint),
-        OPERATOR        20      <=> (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        21      <=| (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        22      |=> (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-STORAGE         timestamptz;
-
-/*
- * rum_tsvector_timestamptz_ops operator class.
- *
- * Stores tsvector with timestamptz.
- */
-
-CREATE OPERATOR CLASS rum_tsvector_timestamptz_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_timestamptz_ops operator class
- */
-
-CREATE OPERATOR CLASS rum_tsvector_hash_timestamptz_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         integer;
-
-/*
- * rum_tsquery_ops operator class.
- *
- * Used for inversed text search.
- */
-
-CREATE FUNCTION ruminv_extract_tsquery(tsquery,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_extract_tsvector(tsvector,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_tsvector_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_tsquery_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsquery_ops
-DEFAULT FOR TYPE tsquery USING rum
-AS
-        OPERATOR        1       @@ (tsquery, tsvector),
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       ruminv_extract_tsquery(tsquery,internal,internal,internal,internal),
-        FUNCTION        3       ruminv_extract_tsvector(tsvector,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       ruminv_tsvector_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        6       ruminv_tsquery_config(internal),
-        STORAGE         text;
diff --git a/rum--1.1.sql b/rum--1.1.sql
deleted file mode 100644
index 88762a2411..0000000000
--- a/rum--1.1.sql
+++ /dev/null
@@ -1,1513 +0,0 @@
-CREATE FUNCTION rumhandler(internal)
-RETURNS index_am_handler
-AS 'MODULE_PATHNAME'
-LANGUAGE C;
-
-/*
- * RUM access method
- */
-
-CREATE ACCESS METHOD rum TYPE INDEX HANDLER rumhandler;
-
-/*
- * RUM built-in types, operators and functions
- */
-
--- Type used in distance calculations with normalization argument
-CREATE TYPE rum_distance_query AS (query tsquery, method int);
-
-CREATE FUNCTION tsquery_to_distance_query(tsquery)
-RETURNS rum_distance_query
-AS 'MODULE_PATHNAME', 'tsquery_to_distance_query'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE CAST (tsquery AS rum_distance_query)
-        WITH FUNCTION tsquery_to_distance_query(tsquery) AS IMPLICIT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,tsquery)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_tt'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,tsquery,int)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_ttf'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,rum_distance_query)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_td'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        LEFTARG = tsvector,
-        RIGHTARG = tsquery,
-        PROCEDURE = rum_ts_distance
-);
-
-CREATE OPERATOR <=> (
-        LEFTARG = tsvector,
-        RIGHTARG = rum_distance_query,
-        PROCEDURE = rum_ts_distance
-);
-
-CREATE FUNCTION rum_timestamp_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        PROCEDURE = rum_timestamp_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_timestamp_left_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-        PROCEDURE = rum_timestamp_left_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_timestamp_right_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-        PROCEDURE = rum_timestamp_right_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = <=|
-);
-
-/*
- * rum_tsvector_ops operator class
- */
-
-CREATE FUNCTION rum_extract_tsvector(tsvector,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsvector_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
--- To prevent calling from SQL
-CREATE FUNCTION rum_ts_join_pos(internal, internal)
-RETURNS bytea
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsvector_ops
-DEFAULT FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        OPERATOR        2       <=> (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        6       rum_tsvector_config(internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        8       rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal),
-        FUNCTION        10      rum_ts_join_pos(internal, internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_ops operator class.
- *
- * Stores hash of entries as keys in index.
- */
-
-CREATE FUNCTION rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsvector_hash_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        OPERATOR        2       <=> (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        6       rum_tsvector_config(internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        8       rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal),
-        FUNCTION        10      rum_ts_join_pos(internal, internal),
-        STORAGE         integer;
-
-/*
- * rum_timestamp_ops operator class
- */
-
--- timestamp operator class
-
-CREATE FUNCTION rum_timestamp_extract_value(timestamp,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_outer_distance(timestamp, timestamp, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE OPERATOR CLASS rum_timestamp_ops
-DEFAULT FOR TYPE timestamp USING rum
-AS
-        OPERATOR        1       <,
-        OPERATOR        2       <=,
-        OPERATOR        3       =,
-        OPERATOR        4       >=,
-        OPERATOR        5       >,
-        --support
-        FUNCTION        1       timestamp_cmp(timestamp,timestamp),
-        FUNCTION        2       rum_timestamp_extract_value(timestamp,internal,internal,internal,internal),
-        FUNCTION        3       rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
-        FUNCTION        5       rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
-        FUNCTION        6       rum_timestamp_config(internal),
-        -- support to timestamp disttance in rum_tsvector_timestamp_ops
-        FUNCTION        9       rum_timestamp_outer_distance(timestamp, timestamp, smallint),
-        OPERATOR        20      <=> (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        21      <=| (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        22      |=> (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-STORAGE         timestamp;
-
-/*
- * rum_tsvector_timestamp_ops operator class.
- *
- * Stores timestamp with tsvector.
- */
-
-CREATE FUNCTION rum_tsquery_timestamp_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-/*
- *	!!!deprecated, use rum_tsvector_hash_addon_ops!!!
- */
-CREATE OPERATOR CLASS rum_tsvector_timestamp_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_timestamp_ops operator class
- *	!!!deprecated, use rum_tsvector_hash_addon_ops!!!
- */
-
-CREATE OPERATOR CLASS rum_tsvector_hash_timestamp_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         integer;
-
-/*
- * rum_timestamptz_ops operator class
- */
-
-CREATE FUNCTION rum_timestamptz_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        PROCEDURE = rum_timestamptz_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_timestamptz_left_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_left_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-        PROCEDURE = rum_timestamptz_left_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_timestamptz_right_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_right_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-        PROCEDURE = rum_timestamptz_right_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = <=|
-);
-
-CREATE OPERATOR CLASS rum_timestamptz_ops
-DEFAULT FOR TYPE timestamptz USING rum
-AS
-        OPERATOR        1       <,
-        OPERATOR        2       <=,
-        OPERATOR        3       =,
-        OPERATOR        4       >=,
-        OPERATOR        5       >,
-        --support
-        FUNCTION        1       timestamptz_cmp(timestamptz,timestamptz),
-        FUNCTION        2       rum_timestamp_extract_value(timestamp,internal,internal,internal,internal),
-        FUNCTION        3       rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
-        FUNCTION        5       rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
-        FUNCTION        6       rum_timestamp_config(internal),
-        -- support to timestamptz distance in rum_tsvector_timestamptz_ops
-        FUNCTION        9       rum_timestamp_outer_distance(timestamp, timestamp, smallint),
-        OPERATOR        20      <=> (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        21      <=| (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        22      |=> (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-STORAGE         timestamptz;
-
-/*
- * rum_tsvector_timestamptz_ops operator class.
- *
- * Stores tsvector with timestamptz.
- */
-
-CREATE OPERATOR CLASS rum_tsvector_timestamptz_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_timestamptz_ops operator class
- */
-
-CREATE OPERATOR CLASS rum_tsvector_hash_timestamptz_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         integer;
-
-/*
- * rum_tsquery_ops operator class.
- *
- * Used for inversed text search.
- */
-
-CREATE FUNCTION ruminv_extract_tsquery(tsquery,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_extract_tsvector(tsvector,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_tsvector_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_tsquery_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsquery_ops
-DEFAULT FOR TYPE tsquery USING rum
-AS
-        OPERATOR        1       @@ (tsquery, tsvector),
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       ruminv_extract_tsquery(tsquery,internal,internal,internal,internal),
-        FUNCTION        3       ruminv_extract_tsvector(tsvector,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       ruminv_tsvector_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        6       ruminv_tsquery_config(internal),
-        STORAGE         text;
-CREATE FUNCTION rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-ALTER FUNCTION
-	rum_tsquery_timestamp_consistent (internal,smallint,tsvector,int,internal,internal,internal,internal)
-	RENAME TO rum_tsquery_addon_consistent;
-
-CREATE FUNCTION rum_numeric_cmp(numeric, numeric)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE OPERATOR CLASS rum_tsvector_addon_ops
-FOR TYPE tsvector USING rum
-AS
-	OPERATOR	1	@@ (tsvector, tsquery),
-	--support function
-	FUNCTION	1	gin_cmp_tslexeme(text, text),
-	FUNCTION	2	rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_tsquery_addon_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	FUNCTION	5	gin_cmp_prefix(text,text,smallint,internal),
-	FUNCTION	7	rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	STORAGE	 text;
-
-CREATE OPERATOR CLASS rum_tsvector_hash_addon_ops
-FOR TYPE tsvector USING rum
-AS
-	OPERATOR	1	@@ (tsvector, tsquery),
-	--support function
-	FUNCTION	1	btint4cmp(integer, integer),
-	FUNCTION	2	rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_tsquery_addon_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	FUNCTION	7	rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	STORAGE	 integer;
-
-/*--------------------int2-----------------------*/
-
-CREATE FUNCTION rum_int2_extract_value(int2, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int2_compare_prefix(int2, int2, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int2_extract_query(int2, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_int2_distance(int2, int2)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_int2_distance,
-	LEFTARG = int2,
-	RIGHTARG = int2,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_int2_left_distance(int2, int2)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_int2_left_distance,
-	LEFTARG = int2,
-	RIGHTARG = int2,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_int2_right_distance(int2, int2)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_int2_right_distance,
-	LEFTARG = int2,
-	RIGHTARG = int2,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_int2_outer_distance(int2, int2, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int2_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_int2_ops
-DEFAULT FOR TYPE int2 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (int2,int2) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (int2,int2) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (int2,int2) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btint2cmp(int2,int2),
-	FUNCTION	2	rum_int2_extract_value(int2, internal),
-	FUNCTION	3	rum_int2_extract_query(int2, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_int2_compare_prefix(int2,int2,int2, internal),
-	-- support to int2 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_int2_config(internal),
-	FUNCTION	9	rum_int2_outer_distance(int2, int2, smallint),
-STORAGE		 int2;
-
-/*--------------------int4-----------------------*/
-
-CREATE FUNCTION rum_int4_extract_value(int4, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int4_compare_prefix(int4, int4, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int4_extract_query(int4, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_int4_distance(int4, int4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_int4_distance,
-	LEFTARG = int4,
-	RIGHTARG = int4,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_int4_left_distance(int4, int4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_int4_left_distance,
-	LEFTARG = int4,
-	RIGHTARG = int4,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_int4_right_distance(int4, int4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_int4_right_distance,
-	LEFTARG = int4,
-	RIGHTARG = int4,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_int4_outer_distance(int4, int4, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int4_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_int4_ops
-DEFAULT FOR TYPE int4 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (int4,int4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (int4,int4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (int4,int4) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btint4cmp(int4,int4),
-	FUNCTION	2	rum_int4_extract_value(int4, internal),
-	FUNCTION	3	rum_int4_extract_query(int4, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_int4_compare_prefix(int4,int4,int2, internal),
-	-- support to int4 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_int4_config(internal),
-	FUNCTION	9	rum_int4_outer_distance(int4, int4, smallint),
-STORAGE		 int4;
-
-/*--------------------int8-----------------------*/
-
-CREATE FUNCTION rum_int8_extract_value(int8, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int8_compare_prefix(int8, int8, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int8_extract_query(int8, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_int8_distance(int8, int8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_int8_distance,
-	LEFTARG = int8,
-	RIGHTARG = int8,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_int8_left_distance(int8, int8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_int8_left_distance,
-	LEFTARG = int8,
-	RIGHTARG = int8,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_int8_right_distance(int8, int8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_int8_right_distance,
-	LEFTARG = int8,
-	RIGHTARG = int8,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_int8_outer_distance(int8, int8, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int8_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_int8_ops
-DEFAULT FOR TYPE int8 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (int8,int8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (int8,int8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (int8,int8) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btint8cmp(int8,int8),
-	FUNCTION	2	rum_int8_extract_value(int8, internal),
-	FUNCTION	3	rum_int8_extract_query(int8, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_int8_compare_prefix(int8,int8,int2, internal),
-	-- support to int8 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_int8_config(internal),
-	FUNCTION	9	rum_int8_outer_distance(int8, int8, smallint),
-STORAGE		 int8;
-
-/*--------------------float4-----------------------*/
-
-CREATE FUNCTION rum_float4_extract_value(float4, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float4_compare_prefix(float4, float4, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float4_extract_query(float4, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_float4_distance(float4, float4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_float4_distance,
-	LEFTARG = float4,
-	RIGHTARG = float4,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_float4_left_distance(float4, float4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_float4_left_distance,
-	LEFTARG = float4,
-	RIGHTARG = float4,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_float4_right_distance(float4, float4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_float4_right_distance,
-	LEFTARG = float4,
-	RIGHTARG = float4,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_float4_outer_distance(float4, float4, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float4_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_float4_ops
-DEFAULT FOR TYPE float4 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (float4,float4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (float4,float4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (float4,float4) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btfloat4cmp(float4,float4),
-	FUNCTION	2	rum_float4_extract_value(float4, internal),
-	FUNCTION	3	rum_float4_extract_query(float4, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_float4_compare_prefix(float4,float4,int2, internal),
-	-- support to float4 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_float4_config(internal),
-	FUNCTION	9	rum_float4_outer_distance(float4, float4, smallint),
-STORAGE		 float4;
-
-/*--------------------float8-----------------------*/
-
-CREATE FUNCTION rum_float8_extract_value(float8, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float8_compare_prefix(float8, float8, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float8_extract_query(float8, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_float8_distance(float8, float8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_float8_distance,
-	LEFTARG = float8,
-	RIGHTARG = float8,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_float8_left_distance(float8, float8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_float8_left_distance,
-	LEFTARG = float8,
-	RIGHTARG = float8,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_float8_right_distance(float8, float8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_float8_right_distance,
-	LEFTARG = float8,
-	RIGHTARG = float8,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_float8_outer_distance(float8, float8, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float8_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_float8_ops
-DEFAULT FOR TYPE float8 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (float8,float8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (float8,float8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (float8,float8) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btfloat8cmp(float8,float8),
-	FUNCTION	2	rum_float8_extract_value(float8, internal),
-	FUNCTION	3	rum_float8_extract_query(float8, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_float8_compare_prefix(float8,float8,int2, internal),
-	-- support to float8 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_float8_config(internal),
-	FUNCTION	9	rum_float8_outer_distance(float8, float8, smallint),
-STORAGE		 float8;
-
-/*--------------------money-----------------------*/
-
-CREATE FUNCTION rum_money_extract_value(money, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_money_compare_prefix(money, money, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_money_extract_query(money, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_money_distance(money, money)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_money_distance,
-	LEFTARG = money,
-	RIGHTARG = money,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_money_left_distance(money, money)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_money_left_distance,
-	LEFTARG = money,
-	RIGHTARG = money,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_money_right_distance(money, money)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_money_right_distance,
-	LEFTARG = money,
-	RIGHTARG = money,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_money_outer_distance(money, money, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_money_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_money_ops
-DEFAULT FOR TYPE money USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (money,money) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (money,money) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (money,money) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	cash_cmp(money,money),
-	FUNCTION	2	rum_money_extract_value(money, internal),
-	FUNCTION	3	rum_money_extract_query(money, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_money_compare_prefix(money,money,int2, internal),
-	-- support to money distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_money_config(internal),
-	FUNCTION	9	rum_money_outer_distance(money, money, smallint),
-STORAGE		 money;
-
-/*--------------------oid-----------------------*/
-
-CREATE FUNCTION rum_oid_extract_value(oid, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_oid_compare_prefix(oid, oid, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_oid_extract_query(oid, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_oid_distance(oid, oid)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_oid_distance,
-	LEFTARG = oid,
-	RIGHTARG = oid,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_oid_left_distance(oid, oid)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_oid_left_distance,
-	LEFTARG = oid,
-	RIGHTARG = oid,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_oid_right_distance(oid, oid)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_oid_right_distance,
-	LEFTARG = oid,
-	RIGHTARG = oid,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_oid_outer_distance(oid, oid, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_oid_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_oid_ops
-DEFAULT FOR TYPE oid USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (oid,oid) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (oid,oid) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (oid,oid) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btoidcmp(oid,oid),
-	FUNCTION	2	rum_oid_extract_value(oid, internal),
-	FUNCTION	3	rum_oid_extract_query(oid, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_oid_compare_prefix(oid,oid,int2, internal),
-	-- support to oid distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_oid_config(internal),
-	FUNCTION	9	rum_oid_outer_distance(oid, oid, smallint),
-STORAGE		 oid;
-
-/*--------------------time-----------------------*/
-
-CREATE FUNCTION rum_time_extract_value(time, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_time_compare_prefix(time, time, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_time_extract_query(time, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_time_ops
-DEFAULT FOR TYPE time USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  time_cmp(time,time),
-	FUNCTION	2	  rum_time_extract_value(time, internal),
-	FUNCTION	3	  rum_time_extract_query(time, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_time_compare_prefix(time,time,int2, internal),
-STORAGE		 time;
-
-/*--------------------timetz-----------------------*/
-
-CREATE FUNCTION rum_timetz_extract_value(timetz, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timetz_compare_prefix(timetz, timetz, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timetz_extract_query(timetz, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_timetz_ops
-DEFAULT FOR TYPE timetz USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  timetz_cmp(timetz,timetz),
-	FUNCTION	2	  rum_timetz_extract_value(timetz, internal),
-	FUNCTION	3	  rum_timetz_extract_query(timetz, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_timetz_compare_prefix(timetz,timetz,int2, internal),
-STORAGE		 timetz;
-
-/*--------------------date-----------------------*/
-
-CREATE FUNCTION rum_date_extract_value(date, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_date_compare_prefix(date, date, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_date_extract_query(date, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_date_ops
-DEFAULT FOR TYPE date USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  date_cmp(date,date),
-	FUNCTION	2	  rum_date_extract_value(date, internal),
-	FUNCTION	3	  rum_date_extract_query(date, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_date_compare_prefix(date,date,int2, internal),
-STORAGE		 date;
-
-/*--------------------interval-----------------------*/
-
-CREATE FUNCTION rum_interval_extract_value(interval, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_interval_compare_prefix(interval, interval, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_interval_extract_query(interval, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_interval_ops
-DEFAULT FOR TYPE interval USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  interval_cmp(interval,interval),
-	FUNCTION	2	  rum_interval_extract_value(interval, internal),
-	FUNCTION	3	  rum_interval_extract_query(interval, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_interval_compare_prefix(interval,interval,int2, internal),
-STORAGE		 interval;
-
-/*--------------------macaddr-----------------------*/
-
-CREATE FUNCTION rum_macaddr_extract_value(macaddr, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_macaddr_compare_prefix(macaddr, macaddr, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_macaddr_extract_query(macaddr, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_macaddr_ops
-DEFAULT FOR TYPE macaddr USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  macaddr_cmp(macaddr,macaddr),
-	FUNCTION	2	  rum_macaddr_extract_value(macaddr, internal),
-	FUNCTION	3	  rum_macaddr_extract_query(macaddr, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_macaddr_compare_prefix(macaddr,macaddr,int2, internal),
-STORAGE		 macaddr;
-
-/*--------------------inet-----------------------*/
-
-CREATE FUNCTION rum_inet_extract_value(inet, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_inet_compare_prefix(inet, inet, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_inet_extract_query(inet, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_inet_ops
-DEFAULT FOR TYPE inet USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  network_cmp(inet,inet),
-	FUNCTION	2	  rum_inet_extract_value(inet, internal),
-	FUNCTION	3	  rum_inet_extract_query(inet, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_inet_compare_prefix(inet,inet,int2, internal),
-STORAGE		 inet;
-
-/*--------------------cidr-----------------------*/
-
-CREATE FUNCTION rum_cidr_extract_value(cidr, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_cidr_compare_prefix(cidr, cidr, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_cidr_extract_query(cidr, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_cidr_ops
-DEFAULT FOR TYPE cidr USING rum
-AS
-	OPERATOR	1	  <		(inet, inet),
-	OPERATOR	2	  <=	(inet, inet),
-	OPERATOR	3	  =		(inet, inet),
-	OPERATOR	4	  >=	(inet, inet),
-	OPERATOR	5	  >		(inet, inet),
-	FUNCTION	1	  network_cmp(inet,inet),
-	FUNCTION	2	  rum_cidr_extract_value(cidr, internal),
-	FUNCTION	3	  rum_cidr_extract_query(cidr, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_cidr_compare_prefix(cidr,cidr,int2, internal),
-STORAGE		 cidr;
-
-/*--------------------text-----------------------*/
-
-CREATE FUNCTION rum_text_extract_value(text, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_text_compare_prefix(text, text, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_text_extract_query(text, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_text_ops
-DEFAULT FOR TYPE text USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  bttextcmp(text,text),
-	FUNCTION	2	  rum_text_extract_value(text, internal),
-	FUNCTION	3	  rum_text_extract_query(text, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_text_compare_prefix(text,text,int2, internal),
-STORAGE		 text;
-
-/*--------------------varchar-----------------------*/
-
-
-CREATE OPERATOR CLASS rum_varchar_ops
-DEFAULT FOR TYPE varchar USING rum
-AS
-	OPERATOR	1	  <		(text, text),
-	OPERATOR	2	  <=	(text, text),
-	OPERATOR	3	  =		(text, text),
-	OPERATOR	4	  >=	(text, text),
-	OPERATOR	5	  >		(text, text),
-	FUNCTION	1	  bttextcmp(text,text),
-	FUNCTION	2	  rum_text_extract_value(text, internal),
-	FUNCTION	3	  rum_text_extract_query(text, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_text_compare_prefix(text,text,int2, internal),
-STORAGE		 varchar;
-
-/*--------------------"char"-----------------------*/
-
-CREATE FUNCTION rum_char_extract_value("char", internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_char_compare_prefix("char", "char", int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_char_extract_query("char", internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_char_ops
-DEFAULT FOR TYPE "char" USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  btcharcmp("char","char"),
-	FUNCTION	2	  rum_char_extract_value("char", internal),
-	FUNCTION	3	  rum_char_extract_query("char", internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_char_compare_prefix("char","char",int2, internal),
-STORAGE		 "char";
-
-/*--------------------bytea-----------------------*/
-
-CREATE FUNCTION rum_bytea_extract_value(bytea, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bytea_compare_prefix(bytea, bytea, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bytea_extract_query(bytea, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_bytea_ops
-DEFAULT FOR TYPE bytea USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  byteacmp(bytea,bytea),
-	FUNCTION	2	  rum_bytea_extract_value(bytea, internal),
-	FUNCTION	3	  rum_bytea_extract_query(bytea, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_bytea_compare_prefix(bytea,bytea,int2, internal),
-STORAGE		 bytea;
-
-/*--------------------bit-----------------------*/
-
-CREATE FUNCTION rum_bit_extract_value(bit, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bit_compare_prefix(bit, bit, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bit_extract_query(bit, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_bit_ops
-DEFAULT FOR TYPE bit USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  bitcmp(bit,bit),
-	FUNCTION	2	  rum_bit_extract_value(bit, internal),
-	FUNCTION	3	  rum_bit_extract_query(bit, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_bit_compare_prefix(bit,bit,int2, internal),
-STORAGE		 bit;
-
-/*--------------------varbit-----------------------*/
-
-CREATE FUNCTION rum_varbit_extract_value(varbit, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_varbit_compare_prefix(varbit, varbit, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_varbit_extract_query(varbit, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_varbit_ops
-DEFAULT FOR TYPE varbit USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  varbitcmp(varbit,varbit),
-	FUNCTION	2	  rum_varbit_extract_value(varbit, internal),
-	FUNCTION	3	  rum_varbit_extract_query(varbit, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_varbit_compare_prefix(varbit,varbit,int2, internal),
-STORAGE		 varbit;
-
-/*--------------------numeric-----------------------*/
-
-CREATE FUNCTION rum_numeric_extract_value(numeric, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_numeric_compare_prefix(numeric, numeric, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_numeric_extract_query(numeric, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_numeric_ops
-DEFAULT FOR TYPE numeric USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  rum_numeric_cmp(numeric,numeric),
-	FUNCTION	2	  rum_numeric_extract_value(numeric, internal),
-	FUNCTION	3	  rum_numeric_extract_query(numeric, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_numeric_compare_prefix(numeric,numeric,int2, internal),
-STORAGE		 numeric;
-
diff --git a/rum--1.2.sql b/rum--1.2.sql
deleted file mode 100644
index 313de039b4..0000000000
--- a/rum--1.2.sql
+++ /dev/null
@@ -1,1707 +0,0 @@
-CREATE FUNCTION rumhandler(internal)
-RETURNS index_am_handler
-AS 'MODULE_PATHNAME'
-LANGUAGE C;
-
-/*
- * RUM access method
- */
-
-CREATE ACCESS METHOD rum TYPE INDEX HANDLER rumhandler;
-
-/*
- * RUM built-in types, operators and functions
- */
-
--- Type used in distance calculations with normalization argument
-CREATE TYPE rum_distance_query AS (query tsquery, method int);
-
-CREATE FUNCTION tsquery_to_distance_query(tsquery)
-RETURNS rum_distance_query
-AS 'MODULE_PATHNAME', 'tsquery_to_distance_query'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE CAST (tsquery AS rum_distance_query)
-        WITH FUNCTION tsquery_to_distance_query(tsquery) AS IMPLICIT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,tsquery)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_tt'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,tsquery,int)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_ttf'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_ts_distance(tsvector,rum_distance_query)
-RETURNS float4
-AS 'MODULE_PATHNAME', 'rum_ts_distance_td'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        LEFTARG = tsvector,
-        RIGHTARG = tsquery,
-        PROCEDURE = rum_ts_distance
-);
-
-CREATE OPERATOR <=> (
-        LEFTARG = tsvector,
-        RIGHTARG = rum_distance_query,
-        PROCEDURE = rum_ts_distance
-);
-
-CREATE FUNCTION rum_timestamp_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        PROCEDURE = rum_timestamp_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_timestamp_left_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-        PROCEDURE = rum_timestamp_left_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_timestamp_right_distance(timestamp, timestamp)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-        PROCEDURE = rum_timestamp_right_distance,
-        LEFTARG = timestamp,
-        RIGHTARG = timestamp,
-        COMMUTATOR = <=|
-);
-
-/*
- * rum_tsvector_ops operator class
- */
-
-CREATE FUNCTION rum_extract_tsvector(tsvector,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsvector_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
--- To prevent calling from SQL
-CREATE FUNCTION rum_ts_join_pos(internal, internal)
-RETURNS bytea
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsvector_ops
-DEFAULT FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        OPERATOR        2       <=> (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        6       rum_tsvector_config(internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        8       rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal),
-        FUNCTION        10      rum_ts_join_pos(internal, internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_ops operator class.
- *
- * Stores hash of entries as keys in index.
- */
-
-CREATE FUNCTION rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsvector_hash_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        OPERATOR        2       <=> (tsvector, tsquery) FOR ORDER BY pg_catalog.float_ops,
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        6       rum_tsvector_config(internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        8       rum_tsquery_distance(internal,smallint,tsvector,int,internal,internal,internal,internal,internal),
-        FUNCTION        10      rum_ts_join_pos(internal, internal),
-        STORAGE         integer;
-
-/*
- * rum_timestamp_ops operator class
- */
-
--- timestamp operator class
-
-CREATE FUNCTION rum_timestamp_extract_value(timestamp,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timestamp_outer_distance(timestamp, timestamp, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE OPERATOR CLASS rum_timestamp_ops
-DEFAULT FOR TYPE timestamp USING rum
-AS
-        OPERATOR        1       <,
-        OPERATOR        2       <=,
-        OPERATOR        3       =,
-        OPERATOR        4       >=,
-        OPERATOR        5       >,
-        --support
-        FUNCTION        1       timestamp_cmp(timestamp,timestamp),
-        FUNCTION        2       rum_timestamp_extract_value(timestamp,internal,internal,internal,internal),
-        FUNCTION        3       rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
-        FUNCTION        5       rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
-        FUNCTION        6       rum_timestamp_config(internal),
-        -- support to timestamp distance in rum_tsvector_timestamp_ops
-        FUNCTION        9       rum_timestamp_outer_distance(timestamp, timestamp, smallint),
-        OPERATOR        20      <=> (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        21      <=| (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        22      |=> (timestamp,timestamp) FOR ORDER BY pg_catalog.float_ops,
-STORAGE         timestamp;
-
-/*
- * rum_tsvector_timestamp_ops operator class.
- *
- * Stores timestamp with tsvector.
- */
-
-CREATE FUNCTION rum_tsquery_timestamp_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-/*
- *	!!!deprecated, use rum_tsvector_addon_ops!!!
- */
-CREATE OPERATOR CLASS rum_tsvector_timestamp_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_timestamp_ops operator class
- *	!!!deprecated, use rum_tsvector_hash_addon_ops!!!
- */
-
-CREATE OPERATOR CLASS rum_tsvector_hash_timestamp_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         integer;
-
-/*
- * rum_timestamptz_ops operator class
- */
-
-CREATE FUNCTION rum_timestamptz_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-        PROCEDURE = rum_timestamptz_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_timestamptz_left_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_left_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-        PROCEDURE = rum_timestamptz_left_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_timestamptz_right_distance(timestamptz, timestamptz)
-RETURNS float8
-AS 'MODULE_PATHNAME', 'rum_timestamp_right_distance'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-        PROCEDURE = rum_timestamptz_right_distance,
-        LEFTARG = timestamptz,
-        RIGHTARG = timestamptz,
-        COMMUTATOR = <=|
-);
-
-CREATE OPERATOR CLASS rum_timestamptz_ops
-DEFAULT FOR TYPE timestamptz USING rum
-AS
-        OPERATOR        1       <,
-        OPERATOR        2       <=,
-        OPERATOR        3       =,
-        OPERATOR        4       >=,
-        OPERATOR        5       >,
-        --support
-        FUNCTION        1       timestamptz_cmp(timestamptz,timestamptz),
-        FUNCTION        2       rum_timestamp_extract_value(timestamp,internal,internal,internal,internal),
-        FUNCTION        3       rum_timestamp_extract_query(timestamp,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_timestamp_consistent(internal,smallint,timestamp,int,internal,internal,internal,internal),
-        FUNCTION        5       rum_timestamp_compare_prefix(timestamp,timestamp,smallint,internal),
-        FUNCTION        6       rum_timestamp_config(internal),
-        -- support to timestamptz distance in rum_tsvector_timestamptz_ops
-        FUNCTION        9       rum_timestamp_outer_distance(timestamp, timestamp, smallint),
-        OPERATOR        20      <=> (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        21      <=| (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-        OPERATOR        22      |=> (timestamptz,timestamptz) FOR ORDER BY pg_catalog.float_ops,
-STORAGE         timestamptz;
-
-/*
- * rum_tsvector_timestamptz_ops operator class.
- *
- * Stores tsvector with timestamptz.
- */
-
-CREATE OPERATOR CLASS rum_tsvector_timestamptz_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        5       gin_cmp_prefix(text,text,smallint,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         text;
-
-/*
- * rum_tsvector_hash_timestamptz_ops operator class
- */
-
-CREATE OPERATOR CLASS rum_tsvector_hash_timestamptz_ops
-FOR TYPE tsvector USING rum
-AS
-        OPERATOR        1       @@ (tsvector, tsquery),
-        --support function
-        FUNCTION        1       btint4cmp(integer, integer),
-        FUNCTION        2       rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-        FUNCTION        3       rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       rum_tsquery_timestamp_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        7       rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        STORAGE         integer;
-
-/*
- * rum_tsquery_ops operator class.
- *
- * Used for inversed text search.
- */
-
-CREATE FUNCTION ruminv_extract_tsquery(tsquery,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_extract_tsvector(tsvector,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_tsvector_consistent(internal, smallint, tsvector, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION ruminv_tsquery_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR CLASS rum_tsquery_ops
-DEFAULT FOR TYPE tsquery USING rum
-AS
-        OPERATOR        1       @@ (tsquery, tsvector),
-        FUNCTION        1       gin_cmp_tslexeme(text, text),
-        FUNCTION        2       ruminv_extract_tsquery(tsquery,internal,internal,internal,internal),
-        FUNCTION        3       ruminv_extract_tsvector(tsvector,internal,smallint,internal,internal,internal,internal),
-        FUNCTION        4       ruminv_tsvector_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-        FUNCTION        6       ruminv_tsquery_config(internal),
-        STORAGE         text;
-/*
- * RUM version 1.1
- */
- 
-CREATE FUNCTION rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-ALTER FUNCTION
-	rum_tsquery_timestamp_consistent (internal,smallint,tsvector,int,internal,internal,internal,internal)
-	RENAME TO rum_tsquery_addon_consistent;
-
-CREATE FUNCTION rum_numeric_cmp(numeric, numeric)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE OPERATOR CLASS rum_tsvector_addon_ops
-FOR TYPE tsvector USING rum
-AS
-	OPERATOR	1	@@ (tsvector, tsquery),
-	--support function
-	FUNCTION	1	gin_cmp_tslexeme(text, text),
-	FUNCTION	2	rum_extract_tsvector(tsvector,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_tsquery(tsquery,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_tsquery_addon_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	FUNCTION	5	gin_cmp_prefix(text,text,smallint,internal),
-	FUNCTION	7	rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	STORAGE	 text;
-
-CREATE OPERATOR CLASS rum_tsvector_hash_addon_ops
-FOR TYPE tsvector USING rum
-AS
-	OPERATOR	1	@@ (tsvector, tsquery),
-	--support function
-	FUNCTION	1	btint4cmp(integer, integer),
-	FUNCTION	2	rum_extract_tsvector_hash(tsvector,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_tsquery_hash(tsquery,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_tsquery_addon_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	FUNCTION	7	rum_tsquery_pre_consistent(internal,smallint,tsvector,int,internal,internal,internal,internal),
-	STORAGE	 integer;
-
-/*--------------------int2-----------------------*/
-
-CREATE FUNCTION rum_int2_extract_value(int2, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int2_compare_prefix(int2, int2, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int2_extract_query(int2, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_int2_distance(int2, int2)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_int2_distance,
-	LEFTARG = int2,
-	RIGHTARG = int2,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_int2_left_distance(int2, int2)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_int2_left_distance,
-	LEFTARG = int2,
-	RIGHTARG = int2,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_int2_right_distance(int2, int2)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_int2_right_distance,
-	LEFTARG = int2,
-	RIGHTARG = int2,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_int2_outer_distance(int2, int2, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int2_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_int2_ops
-DEFAULT FOR TYPE int2 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (int2,int2) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (int2,int2) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (int2,int2) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btint2cmp(int2,int2),
-	FUNCTION	2	rum_int2_extract_value(int2, internal),
-	FUNCTION	3	rum_int2_extract_query(int2, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_int2_compare_prefix(int2,int2,int2, internal),
-	-- support to int2 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_int2_config(internal),
-	FUNCTION	9	rum_int2_outer_distance(int2, int2, smallint),
-STORAGE		 int2;
-
-/*--------------------int4-----------------------*/
-
-CREATE FUNCTION rum_int4_extract_value(int4, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int4_compare_prefix(int4, int4, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int4_extract_query(int4, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_int4_distance(int4, int4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_int4_distance,
-	LEFTARG = int4,
-	RIGHTARG = int4,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_int4_left_distance(int4, int4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_int4_left_distance,
-	LEFTARG = int4,
-	RIGHTARG = int4,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_int4_right_distance(int4, int4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_int4_right_distance,
-	LEFTARG = int4,
-	RIGHTARG = int4,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_int4_outer_distance(int4, int4, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int4_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_int4_ops
-DEFAULT FOR TYPE int4 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (int4,int4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (int4,int4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (int4,int4) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btint4cmp(int4,int4),
-	FUNCTION	2	rum_int4_extract_value(int4, internal),
-	FUNCTION	3	rum_int4_extract_query(int4, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_int4_compare_prefix(int4,int4,int2, internal),
-	-- support to int4 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_int4_config(internal),
-	FUNCTION	9	rum_int4_outer_distance(int4, int4, smallint),
-STORAGE		 int4;
-
-/*--------------------int8-----------------------*/
-
-CREATE FUNCTION rum_int8_extract_value(int8, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int8_compare_prefix(int8, int8, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int8_extract_query(int8, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_int8_distance(int8, int8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_int8_distance,
-	LEFTARG = int8,
-	RIGHTARG = int8,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_int8_left_distance(int8, int8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_int8_left_distance,
-	LEFTARG = int8,
-	RIGHTARG = int8,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_int8_right_distance(int8, int8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_int8_right_distance,
-	LEFTARG = int8,
-	RIGHTARG = int8,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_int8_outer_distance(int8, int8, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_int8_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_int8_ops
-DEFAULT FOR TYPE int8 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (int8,int8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (int8,int8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (int8,int8) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btint8cmp(int8,int8),
-	FUNCTION	2	rum_int8_extract_value(int8, internal),
-	FUNCTION	3	rum_int8_extract_query(int8, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_int8_compare_prefix(int8,int8,int2, internal),
-	-- support to int8 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_int8_config(internal),
-	FUNCTION	9	rum_int8_outer_distance(int8, int8, smallint),
-STORAGE		 int8;
-
-/*--------------------float4-----------------------*/
-
-CREATE FUNCTION rum_float4_extract_value(float4, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float4_compare_prefix(float4, float4, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float4_extract_query(float4, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_float4_distance(float4, float4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_float4_distance,
-	LEFTARG = float4,
-	RIGHTARG = float4,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_float4_left_distance(float4, float4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_float4_left_distance,
-	LEFTARG = float4,
-	RIGHTARG = float4,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_float4_right_distance(float4, float4)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_float4_right_distance,
-	LEFTARG = float4,
-	RIGHTARG = float4,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_float4_outer_distance(float4, float4, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float4_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_float4_ops
-DEFAULT FOR TYPE float4 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (float4,float4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (float4,float4) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (float4,float4) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btfloat4cmp(float4,float4),
-	FUNCTION	2	rum_float4_extract_value(float4, internal),
-	FUNCTION	3	rum_float4_extract_query(float4, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_float4_compare_prefix(float4,float4,int2, internal),
-	-- support to float4 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_float4_config(internal),
-	FUNCTION	9	rum_float4_outer_distance(float4, float4, smallint),
-STORAGE		 float4;
-
-/*--------------------float8-----------------------*/
-
-CREATE FUNCTION rum_float8_extract_value(float8, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float8_compare_prefix(float8, float8, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float8_extract_query(float8, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_float8_distance(float8, float8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_float8_distance,
-	LEFTARG = float8,
-	RIGHTARG = float8,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_float8_left_distance(float8, float8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_float8_left_distance,
-	LEFTARG = float8,
-	RIGHTARG = float8,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_float8_right_distance(float8, float8)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_float8_right_distance,
-	LEFTARG = float8,
-	RIGHTARG = float8,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_float8_outer_distance(float8, float8, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_float8_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_float8_ops
-DEFAULT FOR TYPE float8 USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (float8,float8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (float8,float8) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (float8,float8) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btfloat8cmp(float8,float8),
-	FUNCTION	2	rum_float8_extract_value(float8, internal),
-	FUNCTION	3	rum_float8_extract_query(float8, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_float8_compare_prefix(float8,float8,int2, internal),
-	-- support to float8 distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_float8_config(internal),
-	FUNCTION	9	rum_float8_outer_distance(float8, float8, smallint),
-STORAGE		 float8;
-
-/*--------------------money-----------------------*/
-
-CREATE FUNCTION rum_money_extract_value(money, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_money_compare_prefix(money, money, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_money_extract_query(money, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_money_distance(money, money)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_money_distance,
-	LEFTARG = money,
-	RIGHTARG = money,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_money_left_distance(money, money)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_money_left_distance,
-	LEFTARG = money,
-	RIGHTARG = money,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_money_right_distance(money, money)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_money_right_distance,
-	LEFTARG = money,
-	RIGHTARG = money,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_money_outer_distance(money, money, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_money_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_money_ops
-DEFAULT FOR TYPE money USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (money,money) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (money,money) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (money,money) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	cash_cmp(money,money),
-	FUNCTION	2	rum_money_extract_value(money, internal),
-	FUNCTION	3	rum_money_extract_query(money, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_money_compare_prefix(money,money,int2, internal),
-	-- support to money distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_money_config(internal),
-	FUNCTION	9	rum_money_outer_distance(money, money, smallint),
-STORAGE		 money;
-
-/*--------------------oid-----------------------*/
-
-CREATE FUNCTION rum_oid_extract_value(oid, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_oid_compare_prefix(oid, oid, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_oid_extract_query(oid, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-
-CREATE FUNCTION rum_oid_distance(oid, oid)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_oid_distance,
-	LEFTARG = oid,
-	RIGHTARG = oid,
-	COMMUTATOR = <=>
-);
-
-CREATE FUNCTION rum_oid_left_distance(oid, oid)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR <=| (
-	PROCEDURE = rum_oid_left_distance,
-	LEFTARG = oid,
-	RIGHTARG = oid,
-	COMMUTATOR = |=>
-);
-
-CREATE FUNCTION rum_oid_right_distance(oid, oid)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE OPERATOR |=> (
-	PROCEDURE = rum_oid_right_distance,
-	LEFTARG = oid,
-	RIGHTARG = oid,
-	COMMUTATOR = <=|
-);
-
-CREATE FUNCTION rum_oid_outer_distance(oid, oid, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_oid_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-
-CREATE OPERATOR CLASS rum_oid_ops
-DEFAULT FOR TYPE oid USING rum
-AS
-	OPERATOR	1	<	,
-	OPERATOR	2	<=	,
-	OPERATOR	3	=	,
-	OPERATOR	4	>=	,
-	OPERATOR	5	>	,
-	OPERATOR	20	<=> (oid,oid) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	21	<=| (oid,oid) FOR ORDER BY pg_catalog.float_ops,
-	OPERATOR	22	|=> (oid,oid) FOR ORDER BY pg_catalog.float_ops,
-	FUNCTION	1	btoidcmp(oid,oid),
-	FUNCTION	2	rum_oid_extract_value(oid, internal),
-	FUNCTION	3	rum_oid_extract_query(oid, internal, int2, internal, internal),
-	FUNCTION	4	rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	rum_oid_compare_prefix(oid,oid,int2, internal),
-	-- support to oid distance in rum_tsvector_addon_ops
-	FUNCTION	6	rum_oid_config(internal),
-	FUNCTION	9	rum_oid_outer_distance(oid, oid, smallint),
-STORAGE		 oid;
-
-/*--------------------time-----------------------*/
-
-CREATE FUNCTION rum_time_extract_value(time, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_time_compare_prefix(time, time, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_time_extract_query(time, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_time_ops
-DEFAULT FOR TYPE time USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  time_cmp(time,time),
-	FUNCTION	2	  rum_time_extract_value(time, internal),
-	FUNCTION	3	  rum_time_extract_query(time, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_time_compare_prefix(time,time,int2, internal),
-STORAGE		 time;
-
-/*--------------------timetz-----------------------*/
-
-CREATE FUNCTION rum_timetz_extract_value(timetz, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timetz_compare_prefix(timetz, timetz, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_timetz_extract_query(timetz, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_timetz_ops
-DEFAULT FOR TYPE timetz USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  timetz_cmp(timetz,timetz),
-	FUNCTION	2	  rum_timetz_extract_value(timetz, internal),
-	FUNCTION	3	  rum_timetz_extract_query(timetz, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_timetz_compare_prefix(timetz,timetz,int2, internal),
-STORAGE		 timetz;
-
-/*--------------------date-----------------------*/
-
-CREATE FUNCTION rum_date_extract_value(date, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_date_compare_prefix(date, date, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_date_extract_query(date, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_date_ops
-DEFAULT FOR TYPE date USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  date_cmp(date,date),
-	FUNCTION	2	  rum_date_extract_value(date, internal),
-	FUNCTION	3	  rum_date_extract_query(date, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_date_compare_prefix(date,date,int2, internal),
-STORAGE		 date;
-
-/*--------------------interval-----------------------*/
-
-CREATE FUNCTION rum_interval_extract_value(interval, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_interval_compare_prefix(interval, interval, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_interval_extract_query(interval, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_interval_ops
-DEFAULT FOR TYPE interval USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  interval_cmp(interval,interval),
-	FUNCTION	2	  rum_interval_extract_value(interval, internal),
-	FUNCTION	3	  rum_interval_extract_query(interval, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_interval_compare_prefix(interval,interval,int2, internal),
-STORAGE		 interval;
-
-/*--------------------macaddr-----------------------*/
-
-CREATE FUNCTION rum_macaddr_extract_value(macaddr, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_macaddr_compare_prefix(macaddr, macaddr, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_macaddr_extract_query(macaddr, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_macaddr_ops
-DEFAULT FOR TYPE macaddr USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  macaddr_cmp(macaddr,macaddr),
-	FUNCTION	2	  rum_macaddr_extract_value(macaddr, internal),
-	FUNCTION	3	  rum_macaddr_extract_query(macaddr, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_macaddr_compare_prefix(macaddr,macaddr,int2, internal),
-STORAGE		 macaddr;
-
-/*--------------------inet-----------------------*/
-
-CREATE FUNCTION rum_inet_extract_value(inet, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_inet_compare_prefix(inet, inet, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_inet_extract_query(inet, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_inet_ops
-DEFAULT FOR TYPE inet USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  network_cmp(inet,inet),
-	FUNCTION	2	  rum_inet_extract_value(inet, internal),
-	FUNCTION	3	  rum_inet_extract_query(inet, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_inet_compare_prefix(inet,inet,int2, internal),
-STORAGE		 inet;
-
-/*--------------------cidr-----------------------*/
-
-CREATE FUNCTION rum_cidr_extract_value(cidr, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_cidr_compare_prefix(cidr, cidr, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_cidr_extract_query(cidr, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_cidr_ops
-DEFAULT FOR TYPE cidr USING rum
-AS
-	OPERATOR	1	  <		(inet, inet),
-	OPERATOR	2	  <=	(inet, inet),
-	OPERATOR	3	  =		(inet, inet),
-	OPERATOR	4	  >=	(inet, inet),
-	OPERATOR	5	  >		(inet, inet),
-	FUNCTION	1	  network_cmp(inet,inet),
-	FUNCTION	2	  rum_cidr_extract_value(cidr, internal),
-	FUNCTION	3	  rum_cidr_extract_query(cidr, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_cidr_compare_prefix(cidr,cidr,int2, internal),
-STORAGE		 cidr;
-
-/*--------------------text-----------------------*/
-
-CREATE FUNCTION rum_text_extract_value(text, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_text_compare_prefix(text, text, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_text_extract_query(text, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_text_ops
-DEFAULT FOR TYPE text USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  bttextcmp(text,text),
-	FUNCTION	2	  rum_text_extract_value(text, internal),
-	FUNCTION	3	  rum_text_extract_query(text, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_text_compare_prefix(text,text,int2, internal),
-STORAGE		 text;
-
-/*--------------------varchar-----------------------*/
-
-
-CREATE OPERATOR CLASS rum_varchar_ops
-DEFAULT FOR TYPE varchar USING rum
-AS
-	OPERATOR	1	  <		(text, text),
-	OPERATOR	2	  <=	(text, text),
-	OPERATOR	3	  =		(text, text),
-	OPERATOR	4	  >=	(text, text),
-	OPERATOR	5	  >		(text, text),
-	FUNCTION	1	  bttextcmp(text,text),
-	FUNCTION	2	  rum_text_extract_value(text, internal),
-	FUNCTION	3	  rum_text_extract_query(text, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_text_compare_prefix(text,text,int2, internal),
-STORAGE		 varchar;
-
-/*--------------------"char"-----------------------*/
-
-CREATE FUNCTION rum_char_extract_value("char", internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_char_compare_prefix("char", "char", int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_char_extract_query("char", internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_char_ops
-DEFAULT FOR TYPE "char" USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  btcharcmp("char","char"),
-	FUNCTION	2	  rum_char_extract_value("char", internal),
-	FUNCTION	3	  rum_char_extract_query("char", internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_char_compare_prefix("char","char",int2, internal),
-STORAGE		 "char";
-
-/*--------------------bytea-----------------------*/
-
-CREATE FUNCTION rum_bytea_extract_value(bytea, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bytea_compare_prefix(bytea, bytea, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bytea_extract_query(bytea, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_bytea_ops
-DEFAULT FOR TYPE bytea USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  byteacmp(bytea,bytea),
-	FUNCTION	2	  rum_bytea_extract_value(bytea, internal),
-	FUNCTION	3	  rum_bytea_extract_query(bytea, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_bytea_compare_prefix(bytea,bytea,int2, internal),
-STORAGE		 bytea;
-
-/*--------------------bit-----------------------*/
-
-CREATE FUNCTION rum_bit_extract_value(bit, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bit_compare_prefix(bit, bit, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_bit_extract_query(bit, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_bit_ops
-DEFAULT FOR TYPE bit USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  bitcmp(bit,bit),
-	FUNCTION	2	  rum_bit_extract_value(bit, internal),
-	FUNCTION	3	  rum_bit_extract_query(bit, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_bit_compare_prefix(bit,bit,int2, internal),
-STORAGE		 bit;
-
-/*--------------------varbit-----------------------*/
-
-CREATE FUNCTION rum_varbit_extract_value(varbit, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_varbit_compare_prefix(varbit, varbit, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_varbit_extract_query(varbit, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_varbit_ops
-DEFAULT FOR TYPE varbit USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  varbitcmp(varbit,varbit),
-	FUNCTION	2	  rum_varbit_extract_value(varbit, internal),
-	FUNCTION	3	  rum_varbit_extract_query(varbit, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_varbit_compare_prefix(varbit,varbit,int2, internal),
-STORAGE		 varbit;
-
-/*--------------------numeric-----------------------*/
-
-CREATE FUNCTION rum_numeric_extract_value(numeric, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_numeric_compare_prefix(numeric, numeric, int2, internal)
-RETURNS int4
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-CREATE FUNCTION rum_numeric_extract_query(numeric, internal, int2, internal, internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT IMMUTABLE;
-
-
-CREATE OPERATOR CLASS rum_numeric_ops
-DEFAULT FOR TYPE numeric USING rum
-AS
-	OPERATOR	1	  <		,
-	OPERATOR	2	  <=	,
-	OPERATOR	3	  =		,
-	OPERATOR	4	  >=	,
-	OPERATOR	5	  >		,
-	FUNCTION	1	  rum_numeric_cmp(numeric,numeric),
-	FUNCTION	2	  rum_numeric_extract_value(numeric, internal),
-	FUNCTION	3	  rum_numeric_extract_query(numeric, internal, int2, internal, internal),
-	FUNCTION	4	  rum_btree_consistent(internal,smallint,internal,int,internal,internal,internal,internal),
-	FUNCTION	5	  rum_numeric_compare_prefix(numeric,numeric,int2, internal),
-STORAGE		 numeric;
-
-/*
- * RUM version 1.2
- */
-
-/*--------------------anyarray-----------------------*/
-
-CREATE FUNCTION rum_anyarray_config(internal)
-RETURNS void
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT STABLE;
-
-CREATE OPERATOR % (
-	PROCEDURE = rum_anyarray_similar,
-	LEFTARG = anyarray,
-	RIGHTARG = anyarray,
-	COMMUTATOR = '%',
-	RESTRICT = contsel,
-	JOIN = contjoinsel
-);
-
-
-CREATE FUNCTION rum_anyarray_distance(anyarray,anyarray)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C STRICT STABLE;
-
-CREATE OPERATOR <=> (
-	PROCEDURE = rum_anyarray_distance,
-	LEFTARG = anyarray,
-	RIGHTARG = anyarray,
-	COMMUTATOR = '<=>'
-);
-
-
-CREATE FUNCTION rum_extract_anyarray(anyarray,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_extract_anyarray_query(anyarray,internal,smallint,internal,internal,internal,internal)
-RETURNS internal
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_anyarray_consistent(internal, smallint, anyarray, integer, internal, internal, internal, internal)
-RETURNS bool
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-CREATE FUNCTION rum_anyarray_ordering(internal,smallint,anyarray,int,internal,internal,internal,internal,internal)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-CREATE OPERATOR CLASS rum_anyarray_ops
-DEFAULT FOR TYPE anyarray USING rum
-AS
-	OPERATOR	1	&&  (anyarray, anyarray),
-	OPERATOR	2	@>  (anyarray, anyarray),
-	OPERATOR	3	<@  (anyarray, anyarray),
-	OPERATOR	4	=   (anyarray, anyarray),
-	OPERATOR	5	%   (anyarray, anyarray),
-	OPERATOR	20	<=> (anyarray, anyarray) FOR ORDER BY pg_catalog.float_ops,
-	--dispatch function 1 for concrete type
-	FUNCTION	2	rum_extract_anyarray(anyarray,internal,internal,internal,internal),
-	FUNCTION	3	rum_extract_anyarray_query(anyarray,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	rum_anyarray_consistent(internal,smallint,anyarray,integer,internal,internal,internal,internal),
-	FUNCTION	6	rum_anyarray_config(internal),
-	FUNCTION	8	rum_anyarray_ordering(internal,smallint,anyarray,int,internal,internal,internal,internal,internal),
-	STORAGE anyelement;
-
-CREATE OPERATOR CLASS rum_anyarray_addon_ops
-FOR TYPE anyarray USING rum
-AS
-	OPERATOR	1	&& (anyarray, anyarray),
-	OPERATOR	2	@> (anyarray, anyarray),
-	OPERATOR	3	<@ (anyarray, anyarray),
-	OPERATOR	4	=  (anyarray, anyarray),
-	--dispatch function 1 for concrete type
-	FUNCTION	2	ginarrayextract(anyarray,internal,internal),
-	FUNCTION	3	ginqueryarrayextract(anyarray,internal,smallint,internal,internal,internal,internal),
-	FUNCTION	4	ginarrayconsistent(internal,smallint,anyarray,integer,internal,internal,internal,internal),
-	STORAGE anyelement;
-
-/*--------------------int2-----------------------*/
-
-CREATE FUNCTION rum_int2_key_distance(int2, int2, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_int2_ops USING rum ADD
-	FUNCTION	8	(int2,int2) rum_int2_key_distance(int2, int2, smallint);
-
-/*--------------------int4-----------------------*/
-
-CREATE FUNCTION rum_int4_key_distance(int4, int4, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_int4_ops USING rum ADD
-	FUNCTION	8	(int4,int4) rum_int4_key_distance(int4, int4, smallint);
-
-/*--------------------int8-----------------------*/
-
-CREATE FUNCTION rum_int8_key_distance(int8, int8, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_int8_ops USING rum ADD
-	FUNCTION	8	(int8,int8) rum_int8_key_distance(int8, int8, smallint);
-
-/*--------------------float4-----------------------*/
-
-CREATE FUNCTION rum_float4_key_distance(float4, float4, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_float4_ops USING rum ADD
-	FUNCTION	8	(float4,float4) rum_float4_key_distance(float4, float4, smallint);
-
-/*--------------------float8-----------------------*/
-
-CREATE FUNCTION rum_float8_key_distance(float8, float8, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_float8_ops USING rum ADD
-	FUNCTION	8	(float8,float8) rum_float8_key_distance(float8, float8, smallint);
-
-/*--------------------money-----------------------*/
-
-CREATE FUNCTION rum_money_key_distance(money, money, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_money_ops USING rum ADD
-	FUNCTION	8	(money,money) rum_money_key_distance(money, money, smallint);
-
-/*--------------------oid-----------------------*/
-
-CREATE FUNCTION rum_oid_key_distance(oid, oid, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_oid_ops USING rum ADD
-	FUNCTION	8	(oid,oid) rum_oid_key_distance(oid, oid, smallint);
-
-/*--------------------timestamp-----------------------*/
-
-CREATE FUNCTION rum_timestamp_key_distance(timestamp, timestamp, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_timestamp_ops USING rum ADD
-	FUNCTION	8	(timestamp,timestamp) rum_timestamp_key_distance(timestamp, timestamp, smallint);
-
-/*--------------------timestamptz-----------------------*/
-
-CREATE FUNCTION rum_timestamptz_key_distance(timestamptz, timestamptz, smallint)
-RETURNS float8
-AS 'MODULE_PATHNAME'
-LANGUAGE C IMMUTABLE STRICT;
-
-
-ALTER OPERATOR FAMILY rum_timestamptz_ops USING rum ADD
-	FUNCTION	8	(timestamptz,timestamptz) rum_timestamptz_key_distance(timestamptz, timestamptz, smallint);
-
diff --git a/rum--1.3.sql b/rum_init.sql
similarity index 100%
rename from rum--1.3.sql
rename to rum_init.sql

From c2f0ad54f51709b51c7d2338ab37a285eb2e6f91 Mon Sep 17 00:00:00 2001
From: Zharkov Roman <r.zharkov@postgrespro.ru>
Date: Tue, 21 Jan 2025 16:43:46 +0300
Subject: [PATCH 30/35] Add meson.build file to support building from the
 contrib source tree.

---
 meson.build | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 meson.build

diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000000..b339fcce76
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,96 @@
+# Copyright (c) 2025, Postgres Professional
+
+# Does not support the PGXS infrastructure at this time. Please, compile as part
+# of the contrib source tree.
+
+rum_sources = files(
+  'src/btree_rum.c',
+  'src/rum_arr_utils.c',
+  'src/rum_ts_utils.c',
+  'src/rumbtree.c',
+  'src/rumbulk.c',
+  'src/rumdatapage.c',
+  'src/rumentrypage.c',
+  'src/rumget.c',
+  'src/ruminsert.c',
+  'src/rumscan.c',
+  'src/rumsort.c',
+  'src/rumtsquery.c',
+  'src/rumutil.c',
+  'src/rumvacuum.c',
+  'src/rumvalidate.c',
+)
+
+if host_system == 'windows'
+  rum_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
+    '--NAME', 'rum',
+    '--FILEDESC', 'rum - provides access method to work with the RUM indexes.',])
+endif
+
+rum = shared_module('rum',
+  rum_sources,
+  kwargs: contrib_mod_args,
+)
+contrib_targets += rum
+
+install_data(
+  'rum.control',
+  'rum--1.0--1.1.sql',
+  'rum--1.0.sql',
+  'rum--1.1--1.2.sql',
+  'rum--1.1.sql',
+  'rum--1.2--1.3.sql',
+  'rum--1.2.sql',
+  'rum--1.3.sql',
+  kwargs: contrib_data_args,
+)
+
+tests += {
+  'name': 'rum',
+  'sd': meson.current_source_dir(),
+  'bd': meson.current_build_dir(),
+  'regress': {
+    'sql': [
+      'security',
+      'rum',
+      'rum_validate',
+      'rum_hash',
+      'ruminv',
+      'timestamp',
+      'orderby',
+      'orderby_hash',
+      'altorder',
+      'altorder_hash',
+      'limits',
+      'int2',
+      'int4',
+      'int8',
+      'float4',
+      'float8',
+      'money',
+      'oid',
+      'time',
+      'timetz',
+      'date',
+      'interval',
+      'macaddr',
+      'inet',
+      'cidr',
+      'text',
+      'varchar',
+      'char',
+      'bytea',
+      'bit',
+      'varbit',
+      'numeric',
+      'rum_weight',
+      'expr',
+      'array',
+    ],
+  },
+  'tap': {
+    'tests': [
+      't/001_wal.pl',
+    ],
+  },
+}

From 049b40c9d4e1260a15412c9842e8201fe30bda07 Mon Sep 17 00:00:00 2001
From: Zharkov Roman <r.zharkov@postgrespro.ru>
Date: Thu, 13 Feb 2025 13:00:49 +0700
Subject: [PATCH 31/35] Update meson.build to sync with Makefile.

---
 meson.build | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index b339fcce76..4caf9bb45c 100644
--- a/meson.build
+++ b/meson.build
@@ -3,6 +3,9 @@
 # Does not support the PGXS infrastructure at this time. Please, compile as part
 # of the contrib source tree.
 
+extension = 'rum'
+extversion = '1.3'
+
 rum_sources = files(
   'src/btree_rum.c',
   'src/rum_arr_utils.c',
@@ -33,15 +36,19 @@ rum = shared_module('rum',
 )
 contrib_targets += rum
 
+configure_file(
+  input: 'rum_init.sql',
+  output: extension + '--' + extversion + '.sql',
+  copy: true,
+  install: true,
+  install_dir: contrib_data_args['install_dir'],
+)
+
 install_data(
   'rum.control',
   'rum--1.0--1.1.sql',
-  'rum--1.0.sql',
   'rum--1.1--1.2.sql',
-  'rum--1.1.sql',
   'rum--1.2--1.3.sql',
-  'rum--1.2.sql',
-  'rum--1.3.sql',
   kwargs: contrib_data_args,
 )
 
@@ -91,6 +98,8 @@ tests += {
   'tap': {
     'tests': [
       't/001_wal.pl',
+      't/002_pglist.pl',
     ],
+    'test_kwargs': {'timeout': 3000},
   },
 }

From 2ad36badd1f15093635185a70e71057b8787086c Mon Sep 17 00:00:00 2001
From: Vadim Minigaliev <v.minigaliev@postgrespro.ru>
Date: Thu, 3 Oct 2024 10:01:43 +0300
Subject: [PATCH 32/35] [PGPRO-9336] Fix of isolation tests and beautify
 makefile

---
 .travis.yml                    |   7 -
 Makefile                       |  17 +
 expected/predicate-rum-2.out   | 600 +++++++++++++++++--------------
 expected/predicate-rum-2_1.out | 501 --------------------------
 expected/predicate-rum.out     | 622 ++++++++++++++++++---------------
 expected/predicate-rum_1.out   | 521 ---------------------------
 meson.build                    |  16 +-
 specs/predicate-rum-2.spec     |  24 +-
 specs/predicate-rum.spec       |  24 +-
 9 files changed, 741 insertions(+), 1591 deletions(-)
 delete mode 100644 expected/predicate-rum-2_1.out
 delete mode 100644 expected/predicate-rum_1.out

diff --git a/.travis.yml b/.travis.yml
index 7ee9c5d4cd..0c21a422c2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,10 +35,3 @@ env:
     - PG_VERSION=13 LEVEL=hardcore
     - PG_VERSION=12
     - PG_VERSION=12 LEVEL=hardcore
-    - PG_VERSION=11
-    - PG_VERSION=11 LEVEL=hardcore
-
-matrix:
-    allow_failures:
-        - env: PG_VERSION=11
-        - env: PG_VERSION=11 LEVEL=hardcore
\ No newline at end of file
diff --git a/Makefile b/Makefile
index cca576da85..a8d510019d 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,20 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
 
 TAP_TESTS = 1
 
+ISOLATION = predicate-rum predicate-rum-2
+ISOLATION_OPTS = --load-extension=rum
 EXTRA_CLEAN = pglist_tmp
 
 ifdef USE_PGXS
+
+# We cannot run isolation test for versions 12,13 in PGXS case
+# because 'pg_isolation_regress' is not copied to install
+# directory, see src/test/isolation/Makefile
+ifeq ($(MAJORVERSION),$(filter 12% 13%,$(MAJORVERSION)))
+undefine ISOLATION
+undefine ISOLATION_OPTS
+endif
+
 PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
 include $(PGXS)
@@ -60,6 +71,11 @@ wal-check: temp-install
 check: wal-check
 endif
 
+#
+# Make conditional targets to save backward compatibility with PG11, PG10 and PG9.6.
+#
+ifeq ($(MAJORVERSION), $(filter 9.6% 10% 11%, $(MAJORVERSION)))
+
 install: installincludes
 
 installincludes:
@@ -83,3 +99,4 @@ isolationcheck: | submake-isolation submake-rum temp-install
 	$(pg_isolation_regress_check) \
 		--temp-config $(top_srcdir)/contrib/rum/logical.conf \
 		$(ISOLATIONCHECKS)
+endif
\ No newline at end of file
diff --git a/expected/predicate-rum-2.out b/expected/predicate-rum-2.out
index d8a731091d..20c2d1e21d 100644
--- a/expected/predicate-rum-2.out
+++ b/expected/predicate-rum-2.out
@@ -2,109 +2,129 @@ Parsed test spec with 2 sessions
 
 starting permutation: rxy1 wx1 c1 rxy2 wy2 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
 
 starting permutation: rxy1 wx1 rxy2 c1 wy2 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step c1: COMMIT;
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
 
 starting permutation: rxy1 wx1 rxy2 wy2 c1 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c1: COMMIT;
 step c2: COMMIT;
 
 starting permutation: rxy1 wx1 rxy2 wy2 c2 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
 step c1: COMMIT;
 
 starting permutation: rxy1 rxy2 wx1 c1 wy2 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
@@ -112,21 +132,25 @@ step c2: COMMIT;
 
 starting permutation: rxy1 rxy2 wx1 wy2 c1 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c1: COMMIT;
@@ -134,21 +158,25 @@ step c2: COMMIT;
 
 starting permutation: rxy1 rxy2 wx1 wy2 c2 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
@@ -156,21 +184,25 @@ step c1: COMMIT;
 
 starting permutation: rxy1 rxy2 wy2 wx1 c1 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
@@ -178,21 +210,25 @@ step c2: COMMIT;
 
 starting permutation: rxy1 rxy2 wy2 wx1 c2 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c2: COMMIT;
@@ -200,21 +236,25 @@ step c1: COMMIT;
 
 starting permutation: rxy1 rxy2 wy2 c2 wx1 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -222,21 +262,25 @@ step c1: COMMIT;
 
 starting permutation: rxy2 rxy1 wx1 c1 wy2 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
@@ -244,21 +288,25 @@ step c2: COMMIT;
 
 starting permutation: rxy2 rxy1 wx1 wy2 c1 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c1: COMMIT;
@@ -266,21 +314,25 @@ step c2: COMMIT;
 
 starting permutation: rxy2 rxy1 wx1 wy2 c2 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
@@ -288,21 +340,25 @@ step c1: COMMIT;
 
 starting permutation: rxy2 rxy1 wy2 wx1 c1 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
@@ -310,21 +366,25 @@ step c2: COMMIT;
 
 starting permutation: rxy2 rxy1 wy2 wx1 c2 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c2: COMMIT;
@@ -332,21 +392,25 @@ step c1: COMMIT;
 
 starting permutation: rxy2 rxy1 wy2 c2 wx1 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -354,88 +418,104 @@ step c1: COMMIT;
 
 starting permutation: rxy2 wy2 rxy1 wx1 c1 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
 step c2: COMMIT;
 
 starting permutation: rxy2 wy2 rxy1 wx1 c2 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c2: COMMIT;
 step c1: COMMIT;
 
 starting permutation: rxy2 wy2 rxy1 c2 wx1 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step c2: COMMIT;
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
 
 starting permutation: rxy2 wy2 c2 rxy1 wx1 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
 step c2: COMMIT;
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
 step c1: COMMIT;
diff --git a/expected/predicate-rum-2_1.out b/expected/predicate-rum-2_1.out
deleted file mode 100644
index 8d3e0d173c..0000000000
--- a/expected/predicate-rum-2_1.out
+++ /dev/null
@@ -1,501 +0,0 @@
-Parsed test spec with 2 sessions
-
-starting permutation: rxy1 wx1 c1 rxy2 wy2 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-
-starting permutation: rxy1 wx1 rxy2 c1 wy2 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step c1: COMMIT;
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-
-starting permutation: rxy1 wx1 rxy2 wy2 c1 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c1: COMMIT;
-step c2: COMMIT;
-
-starting permutation: rxy1 wx1 rxy2 wy2 c2 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-step c1: COMMIT;
-
-starting permutation: rxy1 rxy2 wx1 c1 wy2 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-
-starting permutation: rxy1 rxy2 wx1 wy2 c1 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c1: COMMIT;
-step c2: COMMIT;
-
-starting permutation: rxy1 rxy2 wx1 wy2 c2 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-step c1: COMMIT;
-
-starting permutation: rxy1 rxy2 wy2 wx1 c1 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-step c2: COMMIT;
-
-starting permutation: rxy1 rxy2 wy2 wx1 c2 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c2: COMMIT;
-step c1: COMMIT;
-
-starting permutation: rxy1 rxy2 wy2 c2 wx1 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-
-starting permutation: rxy2 rxy1 wx1 c1 wy2 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-
-starting permutation: rxy2 rxy1 wx1 wy2 c1 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c1: COMMIT;
-step c2: COMMIT;
-
-starting permutation: rxy2 rxy1 wx1 wy2 c2 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-step c1: COMMIT;
-
-starting permutation: rxy2 rxy1 wy2 wx1 c1 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-step c2: COMMIT;
-
-starting permutation: rxy2 rxy1 wy2 wx1 c2 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c2: COMMIT;
-step c1: COMMIT;
-
-starting permutation: rxy2 rxy1 wy2 c2 wx1 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-
-starting permutation: rxy2 wy2 rxy1 wx1 c1 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-step c2: COMMIT;
-
-starting permutation: rxy2 wy2 rxy1 wx1 c2 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c2: COMMIT;
-step c1: COMMIT;
-
-starting permutation: rxy2 wy2 rxy1 c2 wx1 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step c2: COMMIT;
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
-
-starting permutation: rxy2 wy2 c2 rxy1 wx1 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('xz');
-step c2: COMMIT;
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('ab');
-step c1: COMMIT;
diff --git a/expected/predicate-rum.out b/expected/predicate-rum.out
index c708c1267a..f4b6ddc4bc 100644
--- a/expected/predicate-rum.out
+++ b/expected/predicate-rum.out
@@ -2,460 +2,522 @@ Parsed test spec with 2 sessions
 
 starting permutation: rxy1 wx1 c1 rxy2 wy2 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+339|'qh'                                                                  
+(6 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
-677            'qh'           
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 
 starting permutation: rxy1 wx1 rxy2 c1 wy2 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step c1: COMMIT;
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-ERROR:  could not serialize access due to read/write dependencies among transactions
 step c2: COMMIT;
 
 starting permutation: rxy1 wx1 rxy2 wy2 c1 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c1: COMMIT;
 step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy1 wx1 rxy2 wy2 c2 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy1 rxy2 wx1 c1 wy2 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-ERROR:  could not serialize access due to read/write dependencies among transactions
 step c2: COMMIT;
 
 starting permutation: rxy1 rxy2 wx1 wy2 c1 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c1: COMMIT;
 step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy1 rxy2 wx1 wy2 c2 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy1 rxy2 wy2 wx1 c1 c2
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
 step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy1 rxy2 wy2 wx1 c2 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c2: COMMIT;
 step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy1 rxy2 wy2 c2 wx1 c1
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-ERROR:  could not serialize access due to read/write dependencies among transactions
 step c1: COMMIT;
 
 starting permutation: rxy2 rxy1 wx1 c1 wy2 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-ERROR:  could not serialize access due to read/write dependencies among transactions
 step c2: COMMIT;
 
 starting permutation: rxy2 rxy1 wx1 wy2 c1 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c1: COMMIT;
 step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy2 rxy1 wx1 wy2 c2 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy2 rxy1 wy2 wx1 c1 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
 step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy2 rxy1 wy2 wx1 c2 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c2: COMMIT;
 step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy2 rxy1 wy2 c2 wx1 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-ERROR:  could not serialize access due to read/write dependencies among transactions
 step c1: COMMIT;
 
 starting permutation: rxy2 wy2 rxy1 wx1 c1 c2
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
 step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy2 wy2 rxy1 wx1 c2 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c2: COMMIT;
 step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
 
 starting permutation: rxy2 wy2 rxy1 c2 wx1 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+(5 rows)
+
 step c2: COMMIT;
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-ERROR:  could not serialize access due to read/write dependencies among transactions
 step c1: COMMIT;
 
 starting permutation: rxy2 wy2 c2 rxy1 wx1 c1
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 10|'af':8 'iy':3 'kg':5 'ln':10 'lq':1 'po':7 'pp':4 'qh':2 'sx':6 'yw':9
+ 77|'da':3 'dr':4 'iy':9 'lq':7 'pp':10 'qh':8 'qj':2 'rs':1 'si':5 'uz':6
+145|'af':10 'iy':5 'kg':7 'lq':3 'po':9 'pp':6 'qh':4 'si':1 'sx':8 'uz':2
+212|'da':5 'dr':6 'hb':2 'kk':1 'lq':9 'qh':10 'qj':4 'rs':3 'si':7 'uz':8
+280|'da':1 'dr':2 'iy':7 'kg':9 'lq':5 'pp':8 'qh':6 'si':3 'sx':10 'uz':4
+(5 rows)
 
-424            'qh':1 'su':2 'tu':3 'ww':4
-230            'iv':1 'lp':2 'mt':4 'qh':3 'ss':5
-248            'jn':1 'js':4 'mx':2 'ne':7 'nn':5 'nw':3 'qh':6
-50             'bx':1 'ca':5 'da':10 'dn':2 'eq':6 'fn':8 'gl':7 'hu':3 'ig':9 'mg':4 'qh':11
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
 step c2: COMMIT;
 step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-165            'gi':1 'gj':2 'gx':6 'hb':5 'hx':8 'ir':7 'sq':3 'yg':4
-74             'cv':1 'de':8 'ds':10 'eh':4 'fd':6 'gh':3 'gi':7 'hn':5 'hx':9 'lo':2
-116            'el':1 'er':9 'ez':6 'gr':3 'gt':4 'hx':7 'ie':5 'iv':2 'od':10 'zf':8
-119            'eo':1 'fc':5 'he':7 'ht':9 'hx':8 'it':2 'km':3 'so':4 'uj':6
-190            'hh':1 'hx':2 'id':5 'iv':3 'ld':7 'ob':6 'oy':4
-206            'hx':1 'it':9 'ji':10 'jl':5 'lq':3 'mh':8 'nq':6 'pc':7 'ub':4 'xi':2
-677            'hx'           
+ id|tsv                                                                   
+---+----------------------------------------------------------------------
+ 28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
+ 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
+231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
+299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+339|'hx'                                                                  
+(6 rows)
+
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
 step c1: COMMIT;
diff --git a/expected/predicate-rum_1.out b/expected/predicate-rum_1.out
deleted file mode 100644
index 7f7a0dc9a6..0000000000
--- a/expected/predicate-rum_1.out
+++ /dev/null
@@ -1,521 +0,0 @@
-Parsed test spec with 2 sessions
-
-starting permutation: rxy1 wx1 c1 rxy2 wy2 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-677            'qh'           
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-
-starting permutation: rxy1 wx1 rxy2 c1 wy2 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step c1: COMMIT;
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-step c2: COMMIT;
-
-starting permutation: rxy1 wx1 rxy2 wy2 c1 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c1: COMMIT;
-step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy1 wx1 rxy2 wy2 c2 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy1 rxy2 wx1 c1 wy2 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-step c2: COMMIT;
-
-starting permutation: rxy1 rxy2 wx1 wy2 c1 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c1: COMMIT;
-step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy1 rxy2 wx1 wy2 c2 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy1 rxy2 wy2 wx1 c1 c2
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
-step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy1 rxy2 wy2 wx1 c2 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c2: COMMIT;
-step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy1 rxy2 wy2 c2 wx1 c1
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-step c1: COMMIT;
-
-starting permutation: rxy2 rxy1 wx1 c1 wy2 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-step c2: COMMIT;
-
-starting permutation: rxy2 rxy1 wx1 wy2 c1 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c1: COMMIT;
-step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy2 rxy1 wx1 wy2 c2 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy2 rxy1 wy2 wx1 c1 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
-step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy2 rxy1 wy2 wx1 c2 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c2: COMMIT;
-step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy2 rxy1 wy2 c2 wx1 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-step c1: COMMIT;
-
-starting permutation: rxy2 wy2 rxy1 wx1 c1 c2
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
-step c2: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy2 wy2 rxy1 wx1 c2 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c2: COMMIT;
-step c1: COMMIT;
-ERROR:  could not serialize access due to read/write dependencies among transactions
-
-starting permutation: rxy2 wy2 rxy1 c2 wx1 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-step c2: COMMIT;
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-ERROR:  could not serialize access due to read/write dependencies among transactions
-step c1: COMMIT;
-
-starting permutation: rxy2 wy2 c2 rxy1 wx1 c1
-step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
-id             tsv            
-
-424            'qh':1 'su':3 'vf':2
-238            'jd':1 'kp':6 'pm':3 'py':5 'qh':4 'ye':2
-299            'lm':1 'nh':6 'nl':3 'op':5 'pl':2 'qh':8 'un':7 'yt':4
-324            'ml':1 'oc':7 'ol':8 'ou':2 'pj':5 'qh':3 'sa':9 'uq':6 'zw':4
-413            'pw':1 'qd':3 'qh':7 'qu':8 'rm':2 'rv':4 'so':5 'sv':6 'tz':9
-147            'fq':1 'ga':2 'gg':3 'iu':9 'iz':10 'kd':5 'lf':4 'mx':7 'qh':11 'tj':6 'yj':8
-step wy2: INSERT INTO rum_tbl(tsv) values('hx');
-step c2: COMMIT;
-step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
-id             tsv            
-
-195            'hm':1 'hu':4 'hx':7 'ja':5 'jz':3 'pf':2 'yy':6
-131            'fa':1 'fo':8 'fs':4 'gq':5 'hx':6 'jh':7 'lw':2 'nx':3
-141            'fk':1 'fm':8 'ft':5 'hd':3 'hx':9 'je':2 'nm':4 'ph':7 're':6
-148            'fr':1 'gz':5 'hq':8 'hx':6 'ia':2 'jj':10 'jt':9 'lo':7 'no':4 'wm':3
-206            'hx':1 'iq':4 'ki':10 'kz':3 'lt':8 'ol':9 'pa':7 'tb':5 'ui':2 'xh':6
-45             'bs':1,5 'bu':8 'ce':7 'dm':6 'ea':9 'ej':10 'fd':2 'gj':11 'hx':4 'vo':3
-162            'gf':1,5 'gz':9 'hx':3 'ik':2 'je':11 'jk':10 'jy':4 'nz':6 'qz':7 'rw':8
-677            'hx'           
-step wx1: INSERT INTO rum_tbl(tsv) values('qh');
-step c1: COMMIT;
diff --git a/meson.build b/meson.build
index b339fcce76..a80260cc8c 100644
--- a/meson.build
+++ b/meson.build
@@ -24,7 +24,7 @@ rum_sources = files(
 if host_system == 'windows'
   rum_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
     '--NAME', 'rum',
-    '--FILEDESC', 'rum - provides access method to work with the RUM indexes.',])
+    '--FILEDESC', 'RUM index access method',])
 endif
 
 rum = shared_module('rum',
@@ -87,10 +87,22 @@ tests += {
       'expr',
       'array',
     ],
+    'regress_args': [
+      '--temp-config', files('logical.conf')
+    ],
   },
   'tap': {
     'tests': [
       't/001_wal.pl',
     ],
   },
-}
+  'isolation': {
+    'specs': [
+      'predicate-rum',
+      'predicate-rum-2',
+    ],
+    'regress_args': [
+      '--temp-config', files('logical.conf'),
+    ],
+  },
+}
\ No newline at end of file
diff --git a/specs/predicate-rum-2.spec b/specs/predicate-rum-2.spec
index 0d0278ed77..763375fa71 100644
--- a/specs/predicate-rum-2.spec
+++ b/specs/predicate-rum-2.spec
@@ -6,24 +6,29 @@
 
 setup
 {
- CREATE EXTENSION rum;
-
  CREATE TABLE rum_tbl (id serial, tsv tsvector);
 
  CREATE TABLE text_table (id1 serial, t text[]);
 
- SELECT SETSEED(0.5);
-
  INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i,
  generate_series(65,90) j ; 
 
- INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM  text_table; 
-
+ -- We need to use pseudorandom to generate values for test table
+ -- In this case we use linear congruential generator because random() 
+ -- function may generate different outputs with different systems
  DO $$
+  DECLARE 
+	c integer := 17;
+	a integer := 261;
+	m integer := 6760;
+	Xi integer := 228;
  BEGIN
- FOR j in 1..10 LOOP
- UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] )
- as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer;
+ FOR i in 1..338 LOOP
+	INSERT INTO rum_tbl(tsv) VALUES ('');
+	FOR j in 1..10 LOOP 
+		UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
+		Xi = (a * Xi + c) % m;
+ 	END LOOP;
  END LOOP;
  END;
  $$;
@@ -35,7 +40,6 @@ teardown
 {
  DROP TABLE text_table;
  DROP TABLE rum_tbl;
- DROP EXTENSION rum;
 }
 
 session "s1"
diff --git a/specs/predicate-rum.spec b/specs/predicate-rum.spec
index 2d87194d40..ec12b51f89 100644
--- a/specs/predicate-rum.spec
+++ b/specs/predicate-rum.spec
@@ -6,24 +6,29 @@
 
 setup
 {
- CREATE EXTENSION rum;
-
  CREATE TABLE rum_tbl (id serial, tsv tsvector);
 
  CREATE TABLE text_table (id1 serial, t text[]);
 
- SELECT SETSEED(0.5);
-
  INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i,
  generate_series(65,90) j ; 
 
- INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM  text_table; 
-
+ -- We need to use pseudorandom to generate values for test table
+ -- In this case we use linear congruential generator because random() 
+ -- function may generate different outputs with different systems
  DO $$
+  DECLARE 
+	c integer := 17;
+	a integer := 261;
+	m integer := 6760;
+	Xi integer := 228;
  BEGIN
- FOR j in 1..10 LOOP
- UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] )
- as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer;
+ FOR i in 1..338 LOOP
+	INSERT INTO rum_tbl(tsv) VALUES ('');
+	FOR j in 1..10 LOOP 
+		UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
+		Xi = (a * Xi + c) % m;
+ 	END LOOP;
  END LOOP;
  END;
  $$;
@@ -35,7 +40,6 @@ teardown
 {
  DROP TABLE text_table;
  DROP TABLE rum_tbl;
- DROP EXTENSION rum;
 }
 
 session "s1"

From 4a1c3005a443f36f4171fa7513d2fc6587fd3122 Mon Sep 17 00:00:00 2001
From: Zharkov Roman <r.zharkov@postgrespro.ru>
Date: Tue, 4 Mar 2025 15:47:51 +0700
Subject: [PATCH 33/35] Update meson.build to make the isolation tests work.

---
 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index d963c020de..b4336f0668 100644
--- a/meson.build
+++ b/meson.build
@@ -112,6 +112,7 @@ tests += {
     ],
     'regress_args': [
       '--temp-config', files('logical.conf'),
+      '--load-extension=rum',
     ],
   },
-}
\ No newline at end of file
+}

From 565a36a887ad87853fcbf139522ae7afa3c9e853 Mon Sep 17 00:00:00 2001
From: Vadim Minigaliev <v.minigaliev@postgrespro.ru>
Date: Fri, 11 Apr 2025 11:54:35 +0300
Subject: [PATCH 34/35] [PGPRO-13081] Fixup for [PGPRO-9336] Fix of isolation
 tests and beautify makefile

Tags: rum
---
 expected/predicate-rum-2.out | 120 +++++++++++++++++------------------
 expected/predicate-rum.out   | 120 +++++++++++++++++------------------
 specs/predicate-rum-2.spec   |   2 +-
 specs/predicate-rum.spec     |   2 +-
 4 files changed, 122 insertions(+), 122 deletions(-)

diff --git a/expected/predicate-rum-2.out b/expected/predicate-rum-2.out
index 20c2d1e21d..cc4720c052 100644
--- a/expected/predicate-rum-2.out
+++ b/expected/predicate-rum-2.out
@@ -5,10 +5,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -31,10 +31,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -57,10 +57,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -83,10 +83,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -109,10 +109,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -135,10 +135,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -161,10 +161,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -187,10 +187,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -213,10 +213,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -239,10 +239,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -275,10 +275,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -301,10 +301,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -327,10 +327,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -353,10 +353,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
@@ -379,10 +379,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
@@ -405,10 +405,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wy2: INSERT INTO rum_tbl(tsv) values('xz');
@@ -432,10 +432,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -458,10 +458,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
@@ -484,10 +484,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step c2: COMMIT;
@@ -511,10 +511,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('ab');
diff --git a/expected/predicate-rum.out b/expected/predicate-rum.out
index f4b6ddc4bc..86071a3c7a 100644
--- a/expected/predicate-rum.out
+++ b/expected/predicate-rum.out
@@ -5,10 +5,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -32,10 +32,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -58,10 +58,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -84,10 +84,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -110,10 +110,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -136,10 +136,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -162,10 +162,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -188,10 +188,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -214,10 +214,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -240,10 +240,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step rxy2: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh';
@@ -276,10 +276,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -302,10 +302,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -328,10 +328,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -354,10 +354,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
@@ -380,10 +380,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
@@ -406,10 +406,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wy2: INSERT INTO rum_tbl(tsv) values('hx');
@@ -433,10 +433,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -459,10 +459,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step wx1: INSERT INTO rum_tbl(tsv) values('qh');
@@ -485,10 +485,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 (5 rows)
 
 step c2: COMMIT;
@@ -512,10 +512,10 @@ step rxy1: SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx';
  id|tsv                                                                   
 ---+----------------------------------------------------------------------
  28|'aq':3 'eo':9 'ep':6 'fh':4 'hi':1 'hx':8 'jz':2 'pf':10 'xy':5 'zg':7
- 96|'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':8 'xy':1 'zg':3               
+ 96|'an':8 'be':9 'eo':5 'ep':2 'hx':4 'nw':7 'pf':6 'pv':10 'xy':1 'zg':3
 163|'aq':5 'ep':8 'fh':6 'hi':3 'hx':10 'jz':4 'sa':1 'sr':2 'xy':7 'zg':9
-231|'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5        
-299|'eo':3 'hx':2 'jd':8 'nw':5 'pf':4 'pv':6 'sm':7 'zg':1               
+231|'an':10 'aq':1 'eo':7 'ep':4 'fh':2 'hx':6 'nw':9 'pf':8 'xy':3 'zg':5
+299|'an':6 'be':7 'eo':3 'hx':2 'jd':10 'nw':5 'pf':4 'pv':8 'sm':9 'zg':1
 339|'hx'                                                                  
 (6 rows)
 
diff --git a/specs/predicate-rum-2.spec b/specs/predicate-rum-2.spec
index 763375fa71..c88383caee 100644
--- a/specs/predicate-rum-2.spec
+++ b/specs/predicate-rum-2.spec
@@ -26,7 +26,7 @@ setup
  FOR i in 1..338 LOOP
 	INSERT INTO rum_tbl(tsv) VALUES ('');
 	FOR j in 1..10 LOOP 
-		UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
+		UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector('simple', t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
 		Xi = (a * Xi + c) % m;
  	END LOOP;
  END LOOP;
diff --git a/specs/predicate-rum.spec b/specs/predicate-rum.spec
index ec12b51f89..4d324b9ef2 100644
--- a/specs/predicate-rum.spec
+++ b/specs/predicate-rum.spec
@@ -26,7 +26,7 @@ setup
  FOR i in 1..338 LOOP
 	INSERT INTO rum_tbl(tsv) VALUES ('');
 	FOR j in 1..10 LOOP 
-		UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector(t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
+		UPDATE rum_tbl SET tsv = tsv || (SELECT to_tsvector('simple', t[1]) FROM text_table WHERE id1 = Xi % 676 + 1) WHERE id = i;
 		Xi = (a * Xi + c) % m;
  	END LOOP;
  END LOOP;

From cbf80ab640fe9147cb228699ee963fdb4fef17ba Mon Sep 17 00:00:00 2001
From: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Date: Fri, 18 Apr 2025 17:58:47 +0300
Subject: [PATCH 35/35] Add generated files to gitignore

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index dfc31f487a..a64cea1abf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
 results
 __pycache__
 *.pyc
+rum--*.sql
 tmp_install
 log