From 933e8b5574859020b75302a9a3fd88cee06ddaf5 Mon Sep 17 00:00:00 2001 From: Pavel Borisov Date: Fri, 14 Jan 2022 16:48:13 +0400 Subject: [PATCH 01/47] 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 Date: Tue, 1 Mar 2022 15:50:54 +0400 Subject: [PATCH 02/47] 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 Date: Fri, 6 May 2022 14:12:07 +0400 Subject: [PATCH 03/47] 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 Date: Thu, 26 May 2022 00:28:08 +0400 Subject: [PATCH 04/47] 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 Postgres Professional Ltd., Russia Teodor Sigaev Postgres Professional Ltd., Russia Arthur Zakirov Postgres Professional Ltd., Russia + +Pavel Borisov Postgres Professional Ltd., Russia + +Maxim Orlov 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 fc3b03b219cc001aff071445cf663ecca76a3727 Mon Sep 17 00:00:00 2001 From: Pavel Borisov Date: Fri, 27 May 2022 16:16:48 +0400 Subject: [PATCH 05/47] Fix TRACE_START redefinition in PG10 - --- src/disable_core_macro.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/disable_core_macro.h b/src/disable_core_macro.h index ed27ed3c2e..922ad4cf75 100644 --- a/src/disable_core_macro.h +++ b/src/disable_core_macro.h @@ -16,9 +16,18 @@ #undef TRACE_POSTGRESQL_SORT_START #undef TRACE_POSTGRESQL_SORT_DONE +#if PG_VERSION_NUM >= 110000 #define TRACE_POSTGRESQL_SORT_START(arg1, arg2, arg3, arg4, arg5, arg6) \ do {} while(0) +#else +#define TRACE_POSTGRESQL_SORT_START(arg1, arg2, arg3, arg4, arg5) \ + do {} while(0) +#endif + + #define TRACE_POSTGRESQL_SORT_DONE(arg1, arg2) \ do {} while(0) + + #endif /* __DISABLE_CORE_MACRO_H__ */ From 92f42d5cd8bb78ee1cb2287ea48b9b1e2b672a33 Mon Sep 17 00:00:00 2001 From: "Mikhail A. Kulagin" Date: Fri, 27 May 2022 16:19:32 +0300 Subject: [PATCH 06/47] * Fix travis warnings root: deprecated key sudo (The key `sudo` has no effect anymore.) root: missing dist, using the default xenial root: missing os, using the default linux * Add pg-15 --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8952b507cd..8b87257d44 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ -sudo: required +os: linux + +dist: bionic language: c @@ -21,6 +23,8 @@ notifications: on_failure: always env: + - PG_VERSION=15beta1 + - PG_VERSION=15beta1 LEVEL=hardcore - PG_VERSION=14 - PG_VERSION=14 LEVEL=hardcore - PG_VERSION=13 From 210abdd6432dca8155b1d1f20c4cad69d198013b Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Thu, 21 Jul 2022 23:22:09 +0300 Subject: [PATCH 07/47] Revert "Make compatible with amroutine changes in V15" Change in IndexAmRoutine amroutine were reverted in e3fcca0d Revert changes in HOT handling of BRIN indexes This reverts commit 6f47dc73ad5281b5daeb53f0f6137aca292fa183. --- src/rumutil.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/rumutil.c b/src/rumutil.c index 1d3719d15c..8838bd8aeb 100644 --- a/src/rumutil.c +++ b/src/rumutil.c @@ -128,9 +128,6 @@ rumhandler(PG_FUNCTION_ARGS) amroutine->ampredlocks = true; #if PG_VERSION_NUM >= 100000 amroutine->amcanparallel = false; -#endif -#if PG_VERSION_NUM >= 150000 - amroutine->amhotblocking = true; #endif amroutine->amkeytype = InvalidOid; From 1ffa817690b2226710d3edc68cb2e3b26c549a2b Mon Sep 17 00:00:00 2001 From: Yura Sokolov Date: Fri, 22 Jul 2022 16:45:01 +0300 Subject: [PATCH 08/47] Update src/tuplessort15.c for new changes upto 2022-06-01 --- src/tuplesort15.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/tuplesort15.c b/src/tuplesort15.c index 6f7a59f5d6..37184cdcac 100644 --- a/src/tuplesort15.c +++ b/src/tuplesort15.c @@ -471,7 +471,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 */ + bool uniqueNullsNotDistinct; /* unique constraint null treatment */ /* These are specific to the index_hash subcase: */ uint32 high_mask; /* masks for sortable part of hash code */ @@ -708,8 +708,8 @@ qsort_tuple_unsigned_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state) return compare; /* - * No need to waste effort calling the tiebreak function when there are - * no other keys to sort on. + * No need to waste effort calling the tiebreak function when there are no + * other keys to sort on. */ if (state->onlyKey != NULL) return 0; @@ -717,6 +717,7 @@ qsort_tuple_unsigned_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state) return state->comparetup(a, b, state); } +#if SIZEOF_DATUM >= 8 /* 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) @@ -731,14 +732,15 @@ qsort_tuple_signed_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state) return compare; /* - * No need to waste effort calling the tiebreak function when there are - * no other keys to sort on. + * 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); } +#endif /* Used if first key's comparator is ssup_datum_int32_compare */ static pg_attribute_always_inline int @@ -747,15 +749,15 @@ 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]); + 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. + * No need to waste effort calling the tiebreak function when there are no + * other keys to sort on. */ if (state->onlyKey != NULL) return 0; @@ -781,6 +783,7 @@ qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state) #define ST_DEFINE #include "lib/sort_template.h" +#if SIZEOF_DATUM >= 8 #define ST_SORT qsort_tuple_signed #define ST_ELEMENT_TYPE SortTuple #define ST_COMPARE(a, b, state) qsort_tuple_signed_compare(a, b, state) @@ -789,6 +792,7 @@ qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state) #define ST_SCOPE static #define ST_DEFINE #include "lib/sort_template.h" +#endif #define ST_SORT qsort_tuple_int32 #define ST_ELEMENT_TYPE SortTuple @@ -3662,23 +3666,22 @@ tuplesort_sort_memtuples(Tuplesortstate *state) { if (state->sortKeys[0].comparator == ssup_datum_unsigned_cmp) { - elog(DEBUG1, "qsort_tuple_unsigned"); qsort_tuple_unsigned(state->memtuples, state->memtupcount, state); return; } +#if SIZEOF_DATUM >= 8 else if (state->sortKeys[0].comparator == ssup_datum_signed_cmp) { - elog(DEBUG1, "qsort_tuple_signed"); qsort_tuple_signed(state->memtuples, state->memtupcount, state); return; } +#endif else if (state->sortKeys[0].comparator == ssup_datum_int32_cmp) { - elog(DEBUG1, "qsort_tuple_int32"); qsort_tuple_int32(state->memtuples, state->memtupcount, state); @@ -3689,13 +3692,11 @@ tuplesort_sort_memtuples(Tuplesortstate *state) /* 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, @@ -4907,16 +4908,12 @@ ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup) return 0; } +#if SIZEOF_DATUM >= 8 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 + int64 xx = DatumGetInt64(x); + int64 yy = DatumGetInt64(y); if (xx < yy) return -1; @@ -4925,12 +4922,13 @@ ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup) else return 0; } +#endif int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup) { - int32 xx = (int32) x; - int32 yy = (int32) y; + int32 xx = DatumGetInt32(x); + int32 yy = DatumGetInt32(y); if (xx < yy) return -1; From 6530adcd0251024b4b97adcadfee69454811dd7d Mon Sep 17 00:00:00 2001 From: Koval Dmitry Date: Mon, 4 Jul 2022 16:21:00 +0300 Subject: [PATCH 09/47] [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 5719f28f1b52428ada7f7ba9ccc8aa1d9aef59b5 Mon Sep 17 00:00:00 2001 From: Maxim Orlov Date: Tue, 6 Sep 2022 16:26:23 +0300 Subject: [PATCH 10/47] Refactoring to be pg16 ready. --- src/rumsort.c | 184 +++++++++++++++++++++++++++++++------------------- 1 file changed, 115 insertions(+), 69 deletions(-) diff --git a/src/rumsort.c b/src/rumsort.c index 39883b910f..962ac1c12f 100644 --- a/src/rumsort.c +++ b/src/rumsort.c @@ -44,8 +44,8 @@ #endif /* - * We need extra field in a state structure but we should not modify struct RumTuplesortstate - * which is inherited from Tuplesortstate core function. + * We need extra field in a state structure but we should not modify struct + * RumTuplesortstate which is inherited from Tuplesortstate core function. */ typedef struct RumTuplesortstateExt { @@ -55,18 +55,28 @@ typedef struct RumTuplesortstateExt static int compare_rum_itempointer(ItemPointerData p1, ItemPointerData p2); static int comparetup_rum(const SortTuple *a, const SortTuple *b, - RumTuplesortstate * state, bool compareItemPointer); + RumTuplesortstate *state, bool compareItemPointer); static int comparetup_rum_true(const SortTuple *a, const SortTuple *b, - RumTuplesortstate * state); + RumTuplesortstate *state); static int comparetup_rum_false(const SortTuple *a, const SortTuple *b, - RumTuplesortstate * state); + RumTuplesortstate *state); static int comparetup_rumitem(const SortTuple *a, const SortTuple *b, - RumTuplesortstate * state); -static void copytup_rum(RumTuplesortstate * state, SortTuple *stup, void *tup); -static void copytup_rumitem(RumTuplesortstate * state, SortTuple *stup, void *tup); -static void *rum_tuplesort_getrum_internal(RumTuplesortstate * state, bool forward, bool *should_free); + RumTuplesortstate *state); +static void copytup_rum(RumTuplesortstate *state, SortTuple *stup, void *tup); +static void copytup_rumitem(RumTuplesortstate *state, SortTuple *stup, + void *tup); +static void *rum_tuplesort_getrum_internal(RumTuplesortstate *state, + bool forward, bool *should_free); + +#if PG_VERSION_NUM >= 160000 +# define TSS_GET(state) \ + TuplesortstateGetPublic((state)) +#else +# define TSS_GET(state) \ + (state) +#endif -static int +static inline int compare_rum_itempointer(ItemPointerData p1, ItemPointerData p2) { if (p1.ip_blkid.bi_hi < p2.ip_blkid.bi_hi) @@ -88,7 +98,8 @@ compare_rum_itempointer(ItemPointerData p1, ItemPointerData p2) } static int -comparetup_rum(const SortTuple *a, const SortTuple *b, RumTuplesortstate * state, bool compareItemPointer) +comparetup_rum(const SortTuple *a, const SortTuple *b, + RumTuplesortstate *state, bool compareItemPointer) { RumSortItem *i1, *i2; @@ -104,7 +115,7 @@ comparetup_rum(const SortTuple *a, const SortTuple *b, RumTuplesortstate * state i1 = (RumSortItem *) a->tuple; i2 = (RumSortItem *) b->tuple; - for (i = 1; i < state->nKeys; i++) + for (i = 1; i < TSS_GET(state)->nKeys; i++) { if (i1->data[i] < i2->data[i]) return -1; @@ -122,19 +133,22 @@ comparetup_rum(const SortTuple *a, const SortTuple *b, RumTuplesortstate * state } static int -comparetup_rum_true(const SortTuple *a, const SortTuple *b, RumTuplesortstate * state) +comparetup_rum_true(const SortTuple *a, const SortTuple *b, + RumTuplesortstate *state) { return comparetup_rum(a, b, state, true); } static int -comparetup_rum_false(const SortTuple *a, const SortTuple *b, RumTuplesortstate * state) +comparetup_rum_false(const SortTuple *a, const SortTuple *b, + RumTuplesortstate *state) { return comparetup_rum(a, b, state, false); } static int -comparetup_rumitem(const SortTuple *a, const SortTuple *b, RumTuplesortstate * state) +comparetup_rumitem(const SortTuple *a, const SortTuple *b, + RumTuplesortstate *state) { RumItem *i1, *i2; @@ -171,23 +185,24 @@ comparetup_rumitem(const SortTuple *a, const SortTuple *b, RumTuplesortstate * s } static void -copytup_rum(RumTuplesortstate * state, SortTuple *stup, void *tup) +copytup_rum(RumTuplesortstate *state, SortTuple *stup, void *tup) { RumSortItem *item = (RumSortItem *) tup; + int nKeys = TSS_GET(state)->nKeys; - stup->datum1 = Float8GetDatum(state->nKeys > 0 ? item->data[0] : 0); + stup->datum1 = Float8GetDatum(nKeys > 0 ? item->data[0] : 0); stup->isnull1 = false; stup->tuple = tup; - USEMEM(state, GetMemoryChunkSpace(tup)); + //USEMEM(state, GetMemoryChunkSpace(tup)); } static void -copytup_rumitem(RumTuplesortstate * state, SortTuple *stup, void *tup) +copytup_rumitem(RumTuplesortstate *state, SortTuple *stup, void *tup) { stup->isnull1 = true; stup->tuple = palloc(sizeof(RumScanItem)); memcpy(stup->tuple, tup, sizeof(RumScanItem)); - USEMEM(state, GetMemoryChunkSpace(stup->tuple)); + //USEMEM(state, GetMemoryChunkSpace(stup->tuple)); } #if PG_VERSION_NUM >= 150000 @@ -200,19 +215,27 @@ copytup_rumitem(RumTuplesortstate * state, SortTuple *stup, void *tup) #define TAPE(state, LT_ARG) state->tapeset, LT_ARG #endif +static void readtup_rum(RumTuplesortstate *state, SortTuple *stup, + LT_TYPE LT_ARG, unsigned int len); + +static void readtup_rumitem(RumTuplesortstate *state, SortTuple *stup, + LT_TYPE LT_ARG, unsigned int len); + static Size -rum_item_size(RumTuplesortstate * state) +rum_item_size(RumTuplesortstate *state) { - if (state->copytup == copytup_rum) - return RumSortItemSize(state->nKeys); - else if (state->copytup == copytup_rumitem) + if (TSS_GET(state)->readtup == readtup_rum) + return RumSortItemSize(TSS_GET(state)->nKeys); + else if (TSS_GET(state)->readtup == readtup_rumitem) return sizeof(RumScanItem); else elog (FATAL, "Unknown RUM state"); + return 0; /* Silence compiler */ } static void -writetup_rum_internal(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup) +writetup_rum_internal(RumTuplesortstate *state, LT_TYPE LT_ARG, + SortTuple *stup) { void *item = stup->tuple; size_t size = rum_item_size(state); @@ -223,28 +246,29 @@ writetup_rum_internal(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup LogicalTapeWrite(TAPE(state, LT_ARG), (void *) item, size); #if PG_VERSION_NUM >= 150000 - if (state->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */ + if (TSS_GET(state)->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing + * length word? */ #else - if (state->randomAccess) /* need trailing length word? */ + if (TSS_GET(state)->randomAccess) /* need trailing length word? */ #endif - LogicalTapeWrite(TAPE(state, LT_ARG), - (void *) &writtenlen, sizeof(writtenlen)); + LogicalTapeWrite(TAPE(TSS_GET(state), LT_ARG), (void *) &writtenlen, + sizeof(writtenlen)); } static void -writetup_rum(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup) +writetup_rum(RumTuplesortstate *state, LT_TYPE LT_ARG, SortTuple *stup) { writetup_rum_internal(state, LT_ARG, stup); } static void -writetup_rumitem(RumTuplesortstate * state, LT_TYPE LT_ARG, SortTuple *stup) +writetup_rumitem(RumTuplesortstate *state, LT_TYPE LT_ARG, SortTuple *stup) { writetup_rum_internal(state, LT_ARG, stup); } static void -readtup_rum_internal(RumTuplesortstate * state, SortTuple *stup, +readtup_rum_internal(RumTuplesortstate *state, SortTuple *stup, LT_TYPE LT_ARG, unsigned int len, bool is_item) { unsigned int tuplen = len - sizeof(unsigned int); @@ -253,36 +277,39 @@ readtup_rum_internal(RumTuplesortstate * state, SortTuple *stup, Assert(tuplen == size); - USEMEM(state, GetMemoryChunkSpace(item)); + //USEMEM(state, GetMemoryChunkSpace(item)); #if PG_VERSION_NUM >= 150000 LogicalTapeReadExact(LT_ARG, item, size); #else - LogicalTapeReadExact(state->tapeset, LT_ARG, item, size); + LogicalTapeReadExact(TSS_GET(state)->tapeset, LT_ARG, item, size); #endif stup->tuple = item; stup->isnull1 = is_item; if (!is_item) - stup->datum1 = Float8GetDatum(state->nKeys > 0 ? ((RumSortItem *) item)->data[0] : 0); + stup->datum1 = Float8GetDatum(TSS_GET(state)->nKeys > 0 ? + ((RumSortItem *) item)->data[0] : 0); #if PG_VERSION_NUM >= 150000 - if (state->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing length word? */ + if (TSS_GET(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)); + if (TSS_GET(state)->randomAccess) + LogicalTapeReadExact(TSS_GET(state)->tapeset, LT_ARG, &tuplen, + sizeof(tuplen)); #endif } static void -readtup_rum(RumTuplesortstate * state, SortTuple *stup, - LT_TYPE LT_ARG, unsigned int len) +readtup_rum(RumTuplesortstate *state, SortTuple *stup, LT_TYPE LT_ARG, + unsigned int len) { readtup_rum_internal(state, stup, LT_ARG, len, false); } static void -readtup_rumitem(RumTuplesortstate * state, SortTuple *stup, - LT_TYPE LT_ARG, unsigned int len) +readtup_rumitem(RumTuplesortstate *state, SortTuple *stup, LT_TYPE LT_ARG, + unsigned int len) { readtup_rum_internal(state, stup, LT_ARG, len, true); } @@ -305,7 +332,7 @@ rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess, #endif MemoryContext oldcontext; - oldcontext = MemoryContextSwitchTo(state->sortcontext); + oldcontext = MemoryContextSwitchTo(TSS_GET(state)->sortcontext); #ifdef TRACE_SORT if (trace_sort) @@ -314,12 +341,11 @@ rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess, nKeys, workMem, randomAccess ? 't' : 'f'); #endif - state->nKeys = nKeys; - - state->comparetup = compareItemPointer ? comparetup_rum_true : comparetup_rum_false; - state->copytup = copytup_rum; - state->writetup = writetup_rum; - state->readtup = readtup_rum; + TSS_GET(state)->nKeys = nKeys; + TSS_GET(state)->comparetup = compareItemPointer ? comparetup_rum_true : + comparetup_rum_false; + TSS_GET(state)->writetup = writetup_rum; + TSS_GET(state)->readtup = readtup_rum; MemoryContextSwitchTo(oldcontext); @@ -333,7 +359,7 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) RumTuplesortstateExt *rs; MemoryContext oldcontext; - oldcontext = MemoryContextSwitchTo(state->sortcontext); + oldcontext = MemoryContextSwitchTo(TSS_GET(state)->sortcontext); /* Allocate extended state in the same context as state */ rs = palloc(sizeof(*rs)); @@ -345,10 +371,9 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) #endif rs->cmp = cmp; - state->comparetup = comparetup_rumitem; - state->copytup = copytup_rumitem; - state->writetup = writetup_rumitem; - state->readtup = readtup_rumitem; + TSS_GET(state)->comparetup = comparetup_rumitem; + TSS_GET(state)->writetup = writetup_rumitem; + TSS_GET(state)->readtup = readtup_rumitem; memcpy(&rs->ts, state, sizeof(RumTuplesortstate)); pfree(state); /* just to be sure *state isn't used anywhere * else */ @@ -368,7 +393,7 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) * pointers afterwards! */ void -rum_tuplesort_end(RumTuplesortstate * state) +rum_tuplesort_end(RumTuplesortstate *state) { #if PG_VERSION_NUM >= 130000 tuplesort_free(state); @@ -382,39 +407,57 @@ rum_tuplesort_end(RumTuplesortstate * state) * RumSortItem. */ MemoryContext -rum_tuplesort_get_memorycontext(RumTuplesortstate * state) +rum_tuplesort_get_memorycontext(RumTuplesortstate *state) { - return state->sortcontext; + return TSS_GET(state)->sortcontext; } void rum_tuplesort_putrum(RumTuplesortstate *state, RumSortItem *item) { - tuplesort_puttupleslot(state, (TupleTableSlot *) item); + MemoryContext oldcontext; + SortTuple stup; + + oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); + copytup_rum(state, &stup, item); + puttuple_common(state, &stup); + + MemoryContextSwitchTo(oldcontext); } void rum_tuplesort_putrumitem(RumTuplesortstate *state, RumScanItem *item) { - tuplesort_puttupleslot(state, (TupleTableSlot *) item); + MemoryContext oldcontext; + SortTuple stup; + + oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); + copytup_rumitem(state, &stup, item); + puttuple_common(state, &stup); + + MemoryContextSwitchTo(oldcontext); } void -rum_tuplesort_performsort(RumTuplesortstate * state) +rum_tuplesort_performsort(RumTuplesortstate *state) { tuplesort_performsort(state); } /* - * Internal routine to fetch the next index tuple in either forward or back direction. - * Returns NULL if no more tuples. Returned tuple belongs to tuplesort memory context. Caller may not rely on tuple remaining valid after any further manipulation of tuplesort. + * Internal routine to fetch the next index tuple in either forward or back + * direction. Returns NULL if no more tuples. Returned tuple belongs to + * tuplesort memory context. Caller may not rely on tuple remaining valid after + * any further manipulation of tuplesort. + * * If *should_free is set, the caller must pfree stup.tuple when done with it. * - * NOTE: in PG 10 and newer tuple is always allocated tuple in tuplesort context and - * should not be freed by caller. + * NOTE: in PG 10 and newer tuple is always allocated tuple in tuplesort context + * and should not be freed by caller. */ static void * -rum_tuplesort_getrum_internal(RumTuplesortstate * state, bool forward, bool *should_free) +rum_tuplesort_getrum_internal(RumTuplesortstate *state, bool forward, + bool *should_free) { #if PG_VERSION_NUM >= 100000 *should_free = false; @@ -425,13 +468,16 @@ rum_tuplesort_getrum_internal(RumTuplesortstate * state, bool forward, bool *sho } RumSortItem * -rum_tuplesort_getrum(RumTuplesortstate * state, bool forward, bool *should_free) +rum_tuplesort_getrum(RumTuplesortstate *state, bool forward, bool *should_free) { - return (RumSortItem *) rum_tuplesort_getrum_internal(state, forward, should_free); + return (RumSortItem *) rum_tuplesort_getrum_internal(state, forward, + should_free); } RumScanItem * -rum_tuplesort_getrumitem(RumTuplesortstate * state, bool forward, bool *should_free) +rum_tuplesort_getrumitem(RumTuplesortstate *state, bool forward, + bool *should_free) { - return (RumScanItem *) rum_tuplesort_getrum_internal(state, forward, should_free); + return (RumScanItem *) rum_tuplesort_getrum_internal(state, forward, + should_free); } From db8b9d6efa0a823e46109b819d4586c53ca11ed3 Mon Sep 17 00:00:00 2001 From: Maxim Orlov Date: Tue, 6 Sep 2022 17:08:18 +0300 Subject: [PATCH 11/47] Add support for pg16. --- src/rumsort.c | 60 +++++---- src/tuplesort16.c | 307 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 343 insertions(+), 24 deletions(-) create mode 100644 src/tuplesort16.c diff --git a/src/rumsort.c b/src/rumsort.c index 962ac1c12f..66d9fd322a 100644 --- a/src/rumsort.c +++ b/src/rumsort.c @@ -27,7 +27,10 @@ #include "rum.h" /* RumItem */ -#if PG_VERSION_NUM >= 150000 +#if PG_VERSION_NUM >= 160000 +#include "tuplesort16.c" +#undef TRACE_SORT +#elif PG_VERSION_NUM >= 150000 #include "tuplesort15.c" #elif PG_VERSION_NUM >= 140000 #include "tuplesort14.c" @@ -53,7 +56,6 @@ typedef struct RumTuplesortstateExt FmgrInfo *cmp; } RumTuplesortstateExt; -static int compare_rum_itempointer(ItemPointerData p1, ItemPointerData p2); static int comparetup_rum(const SortTuple *a, const SortTuple *b, RumTuplesortstate *state, bool compareItemPointer); static int comparetup_rum_true(const SortTuple *a, const SortTuple *b, @@ -69,11 +71,19 @@ static void *rum_tuplesort_getrum_internal(RumTuplesortstate *state, bool forward, bool *should_free); #if PG_VERSION_NUM >= 160000 -# define TSS_GET(state) \ - TuplesortstateGetPublic((state)) +# define TSS_GET(state) TuplesortstateGetPublic((state)) +#else +# define TSS_GET(state) (state) +#endif + +#if PG_VERSION_NUM >= 150000 +#define LT_TYPE LogicalTape * +#define LT_ARG tape +#define TAPE(state, LT_ARG) LT_ARG #else -# define TSS_GET(state) \ - (state) +#define LT_TYPE int +#define LT_ARG tapenum +#define TAPE(state, LT_ARG) state->tapeset, LT_ARG #endif static inline int @@ -152,12 +162,14 @@ comparetup_rumitem(const SortTuple *a, const SortTuple *b, { RumItem *i1, *i2; + FmgrInfo *cmp; /* Extract RumItem from RumScanItem */ i1 = (RumItem *) a->tuple; i2 = (RumItem *) b->tuple; - if (((RumTuplesortstateExt *) state)->cmp) + cmp = ((RumTuplesortstateExt *) state)->cmp; + if (cmp != NULL) { if (i1->addInfoIsNull || i2->addInfoIsNull) { @@ -169,7 +181,7 @@ comparetup_rumitem(const SortTuple *a, const SortTuple *b, { int r; - r = DatumGetInt32(FunctionCall2(((RumTuplesortstateExt *) state)->cmp, + r = DatumGetInt32(FunctionCall2(cmp, i1->addInfo, i2->addInfo)); @@ -193,7 +205,7 @@ copytup_rum(RumTuplesortstate *state, SortTuple *stup, void *tup) stup->datum1 = Float8GetDatum(nKeys > 0 ? item->data[0] : 0); stup->isnull1 = false; stup->tuple = tup; - //USEMEM(state, GetMemoryChunkSpace(tup)); + USEMEM(state, GetMemoryChunkSpace(tup)); } static void @@ -202,19 +214,9 @@ copytup_rumitem(RumTuplesortstate *state, SortTuple *stup, void *tup) stup->isnull1 = true; stup->tuple = palloc(sizeof(RumScanItem)); memcpy(stup->tuple, tup, sizeof(RumScanItem)); - //USEMEM(state, GetMemoryChunkSpace(stup->tuple)); + USEMEM(state, GetMemoryChunkSpace(stup->tuple)); } -#if PG_VERSION_NUM >= 150000 -#define LT_TYPE LogicalTape * -#define LT_ARG tape -#define TAPE(state, LT_ARG) LT_ARG -#else -#define LT_TYPE int -#define LT_ARG tapenum -#define TAPE(state, LT_ARG) state->tapeset, LT_ARG -#endif - static void readtup_rum(RumTuplesortstate *state, SortTuple *stup, LT_TYPE LT_ARG, unsigned int len); @@ -228,9 +230,9 @@ rum_item_size(RumTuplesortstate *state) return RumSortItemSize(TSS_GET(state)->nKeys); else if (TSS_GET(state)->readtup == readtup_rumitem) return sizeof(RumScanItem); - else - elog (FATAL, "Unknown RUM state"); - return 0; /* Silence compiler */ + + elog (FATAL, "Unknown RUM state"); + return 0; /* keep compiler quiet */ } static void @@ -277,7 +279,7 @@ readtup_rum_internal(RumTuplesortstate *state, SortTuple *stup, Assert(tuplen == size); - //USEMEM(state, GetMemoryChunkSpace(item)); + USEMEM(state, GetMemoryChunkSpace(item)); #if PG_VERSION_NUM >= 150000 LogicalTapeReadExact(LT_ARG, item, size); #else @@ -420,7 +422,12 @@ rum_tuplesort_putrum(RumTuplesortstate *state, RumSortItem *item) oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); copytup_rum(state, &stup, item); + +#if PG_VERSION_NUM >= 160000 + tuplesort_puttuple_common(state, &stup, false); +#else puttuple_common(state, &stup); +#endif MemoryContextSwitchTo(oldcontext); } @@ -433,7 +440,12 @@ rum_tuplesort_putrumitem(RumTuplesortstate *state, RumScanItem *item) oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); copytup_rumitem(state, &stup, item); + +#if PG_VERSION_NUM >= 160000 + tuplesort_puttuple_common(state, &stup, false); +#else puttuple_common(state, &stup); +#endif MemoryContextSwitchTo(oldcontext); } diff --git a/src/tuplesort16.c b/src/tuplesort16.c new file mode 100644 index 0000000000..694d8f1a83 --- /dev/null +++ b/src/tuplesort16.c @@ -0,0 +1,307 @@ +/*------------------------------------------------------------------------- + * + * tuplesort16.c + * This file is a copy-paste from src/backend/utils/sort/tuplesort.c + * + * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group + * Portions Copyright (c) 1994, Regents of the University of California + * + * IDENTIFICATION + * rum/tuplesort16.c + * + *------------------------------------------------------------------------- + */ + +#include "postgres.h" + +#include + +#include "catalog/pg_am.h" +#include "commands/tablespace.h" +#include "executor/executor.h" +#include "miscadmin.h" +#include "pg_trace.h" +#include "storage/shmem.h" +#include "utils/memutils.h" +#include "utils/pg_rusage.h" +#include "utils/rel.h" +#include "utils/tuplesort.h" + +/* GUC variables */ +#ifdef TRACE_SORT +bool trace_sort = false; +#endif + +/* + * During merge, we use a pre-allocated set of fixed-size slots to hold + * tuples. To avoid palloc/pfree overhead. + * + * Merge doesn't require a lot of memory, so we can afford to waste some, + * by using gratuitously-sized slots. If a tuple is larger than 1 kB, the + * palloc() overhead is not significant anymore. + * + * 'nextfree' is valid when this chunk is in the free list. When in use, the + * slot holds a tuple. + */ +#define SLAB_SLOT_SIZE 1024 + +typedef union SlabSlot +{ + union SlabSlot *nextfree; + char buffer[SLAB_SLOT_SIZE]; +} SlabSlot; + +/* + * Possible states of a Tuplesort object. These denote the states that + * persist between calls of Tuplesort routines. + */ +typedef enum +{ + TSS_INITIAL, /* Loading tuples; still within memory limit */ + TSS_BOUNDED, /* Loading tuples into bounded-size heap */ + TSS_BUILDRUNS, /* Loading tuples; writing to tape */ + TSS_SORTEDINMEM, /* Sort completed entirely in memory */ + TSS_SORTEDONTAPE, /* Sort completed, final run is on tape */ + TSS_FINALMERGE /* Performing final merge on-the-fly */ +} TupSortStatus; + +/* + * Parameters for calculation of number of tapes to use --- see inittapes() + * and tuplesort_merge_order(). + * + * In this calculation we assume that each tape will cost us about 1 blocks + * worth of buffer space. This ignores the overhead of all the other data + * structures needed for each tape, but it's probably close enough. + * + * MERGE_BUFFER_SIZE is how much buffer space we'd like to allocate for each + * input tape, for pre-reading (see discussion at top of file). This is *in + * addition to* the 1 block already included in TAPE_BUFFER_OVERHEAD. + */ +#define MINORDER 6 /* minimum merge order */ +#define MAXORDER 500 /* maximum merge order */ +#define TAPE_BUFFER_OVERHEAD BLCKSZ +#define MERGE_BUFFER_SIZE (BLCKSZ * 32) + + +/* + * Private state of a Tuplesort operation. + */ +struct Tuplesortstate +{ + TuplesortPublic base; + TupSortStatus status; /* enumerated value as shown above */ + bool bounded; /* did caller specify a maximum number of + * tuples to return? */ + bool boundUsed; /* true if we made use of a bounded heap */ + int bound; /* if bounded, the maximum number of tuples */ + int64 availMem; /* remaining memory available, in bytes */ + int64 allowedMem; /* total memory allowed, in bytes */ + int maxTapes; /* max number of input tapes to merge in each + * pass */ + int64 maxSpace; /* maximum amount of space occupied among sort + * of groups, either in-memory or on-disk */ + bool isMaxSpaceDisk; /* true when maxSpace is value for on-disk + * space, false when it's value for in-memory + * space */ + TupSortStatus maxSpaceStatus; /* sort status when maxSpace was reached */ + LogicalTapeSet *tapeset; /* logtape.c object for tapes in a temp file */ + + /* + * 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 + * SORTEDINMEM, the tuples are in final sorted order; in states BUILDRUNS + * and FINALMERGE, the tuples are organized in "heap" order per Algorithm + * H. In state SORTEDONTAPE, the array is not used. + */ + SortTuple *memtuples; /* array of SortTuple structs */ + int memtupcount; /* number of tuples currently present */ + int memtupsize; /* allocated length of memtuples array */ + bool growmemtuples; /* memtuples' growth still underway? */ + + /* + * Memory for tuples is sometimes allocated using a simple slab allocator, + * rather than with palloc(). Currently, we switch to slab allocation + * when we start merging. Merging only needs to keep a small, fixed + * number of tuples in memory at any time, so we can avoid the + * palloc/pfree overhead by recycling a fixed number of fixed-size slots + * to hold the tuples. + * + * For the slab, we use one large allocation, divided into SLAB_SLOT_SIZE + * slots. The allocation is sized to have one slot per tape, plus one + * additional slot. We need that many slots to hold all the tuples kept + * in the heap during merge, plus the one we have last returned from the + * sort, with tuplesort_gettuple. + * + * Initially, all the slots are kept in a linked list of free slots. When + * a tuple is read from a tape, it is put to the next available slot, if + * it fits. If the tuple is larger than SLAB_SLOT_SIZE, it is palloc'd + * instead. + * + * When we're done processing a tuple, we return the slot back to the free + * list, or pfree() if it was palloc'd. We know that a tuple was + * allocated from the slab, if its pointer value is between + * slabMemoryBegin and -End. + * + * When the slab allocator is used, the USEMEM/LACKMEM mechanism of + * tracking memory usage is not used. + */ + bool slabAllocatorUsed; + + char *slabMemoryBegin; /* beginning of slab memory arena */ + char *slabMemoryEnd; /* end of slab memory arena */ + SlabSlot *slabFreeHead; /* head of free list */ + + /* Memory used for input and output tape buffers. */ + size_t tape_buffer_mem; + + /* + * When we return a tuple to the caller in tuplesort_gettuple_XXX, that + * came from a tape (that is, in TSS_SORTEDONTAPE or TSS_FINALMERGE + * modes), we remember the tuple in 'lastReturnedTuple', so that we can + * recycle the memory on next gettuple call. + */ + void *lastReturnedTuple; + + /* + * While building initial runs, this is the current output run number. + * Afterwards, it is the number of initial runs we made. + */ + int currentRun; + + /* + * Logical tapes, for merging. + * + * The initial runs are written in the output tapes. In each merge pass, + * the output tapes of the previous pass become the input tapes, and new + * output tapes are created as needed. When nInputTapes equals + * nInputRuns, there is only one merge pass left. + */ + LogicalTape **inputTapes; + int nInputTapes; + int nInputRuns; + + LogicalTape **outputTapes; + int nOutputTapes; + int nOutputRuns; + + LogicalTape *destTape; /* current output tape */ + + /* + * These variables are used after completion of sorting to keep track of + * the next tuple to return. (In the tape case, the tape's current read + * position is also critical state.) + */ + LogicalTape *result_tape; /* actual tape of finished output */ + int current; /* array index (only used if SORTEDINMEM) */ + bool eof_reached; /* reached EOF (needed for cursors) */ + + /* markpos_xxx holds marked position for mark and restore */ + long markpos_block; /* tape block# (only used if SORTEDONTAPE) */ + int markpos_offset; /* saved "current", or offset in tape block */ + bool markpos_eof; /* saved "eof_reached" */ + + /* + * These variables are used during parallel sorting. + * + * worker is our worker identifier. Follows the general convention that + * -1 value relates to a leader tuplesort, and values >= 0 worker + * tuplesorts. (-1 can also be a serial tuplesort.) + * + * shared is mutable shared memory state, which is used to coordinate + * parallel sorts. + * + * nParticipants is the number of worker Tuplesortstates known by the + * leader to have actually been launched, which implies that they must + * finish a run that the leader needs to merge. Typically includes a + * worker state held by the leader process itself. Set in the leader + * Tuplesortstate only. + */ + int worker; + Sharedsort *shared; + int nParticipants; + + /* + * Additional state for managing "abbreviated key" sortsupport routines + * (which currently may be used by all cases except the hash index case). + * Tracks the intervals at which the optimization's effectiveness is + * tested. + */ + int64 abbrevNext; /* Tuple # at which to next check + * applicability */ + + /* + * Resource snapshot for time of sort start. + */ +#ifdef TRACE_SORT + PGRUsage ru_start; +#endif +}; + +#define FREESTATE(state) ((state)->base.freestate ? (*(state)->base.freestate) (state) : (void) 0) +#define USEMEM(state,amt) ((state)->availMem -= (amt)) +#define SERIAL(state) ((state)->shared == NULL) + +/* + * tuplesort_free + * + * Internal routine for freeing resources of tuplesort. + */ +static void +tuplesort_free(Tuplesortstate *state) +{ + /* context swap probably not needed, but let's be safe */ + MemoryContext oldcontext = MemoryContextSwitchTo(state->base.sortcontext); + +#ifdef TRACE_SORT + long spaceUsed; + + if (state->tapeset) + spaceUsed = LogicalTapeSetBlocks(state->tapeset); + else + spaceUsed = (state->allowedMem - state->availMem + 1023) / 1024; +#endif + + /* + * Delete temporary "tape" files, if any. + * + * Note: want to include this in reported total cost of sort, hence need + * for two #ifdef TRACE_SORT sections. + * + * We don't bother to destroy the individual tapes here. They will go away + * with the sortcontext. (In TSS_FINALMERGE state, we have closed + * finished tapes already.) + */ + if (state->tapeset) + LogicalTapeSetClose(state->tapeset); + +#ifdef TRACE_SORT + if (trace_sort) + { + if (state->tapeset) + elog(LOG, "%s of worker %d ended, %ld disk blocks used: %s", + SERIAL(state) ? "external sort" : "parallel external sort", + state->worker, spaceUsed, pg_rusage_show(&state->ru_start)); + else + elog(LOG, "%s of worker %d ended, %ld KB used: %s", + SERIAL(state) ? "internal sort" : "unperformed parallel sort", + state->worker, spaceUsed, pg_rusage_show(&state->ru_start)); + } + + TRACE_POSTGRESQL_SORT_DONE(state->tapeset != NULL, spaceUsed); +#else + + /* + * If you disabled TRACE_SORT, you can still probe sort__done, but you + * ain't getting space-used stats. + */ + TRACE_POSTGRESQL_SORT_DONE(state->tapeset != NULL, 0L); +#endif + + FREESTATE(state); + MemoryContextSwitchTo(oldcontext); + + /* + * Free the per-sort memory context, thereby releasing all working memory. + */ + MemoryContextReset(state->base.sortcontext); +} From 919c74fc4b51080b45222e0d4c75902e5f2725aa Mon Sep 17 00:00:00 2001 From: Maxim Orlov Date: Tue, 6 Sep 2022 18:15:57 +0300 Subject: [PATCH 12/47] Get rid of copying code from pg core. --- src/rumsort.c | 123 +++++++++++++++---- src/tuplesort16.c | 307 ---------------------------------------------- 2 files changed, 96 insertions(+), 334 deletions(-) delete mode 100644 src/tuplesort16.c diff --git a/src/rumsort.c b/src/rumsort.c index 66d9fd322a..b5691301c9 100644 --- a/src/rumsort.c +++ b/src/rumsort.c @@ -28,8 +28,10 @@ #include "rum.h" /* RumItem */ #if PG_VERSION_NUM >= 160000 -#include "tuplesort16.c" -#undef TRACE_SORT +/* + * After allocating a public interface for Tuplesortstate, no need to include + * source code from pg-core. + */ #elif PG_VERSION_NUM >= 150000 #include "tuplesort15.c" #elif PG_VERSION_NUM >= 140000 @@ -46,6 +48,26 @@ #include "tuplesort96.c" #endif +/* + * In case of using custom compare function we should store function pointer in + * sort stare in order to use it later. + */ + +#if PG_VERSION_NUM >= 160000 +/* + * After allocating a public interface for Tuplesortstate we may use + * TuplesortPublic->arg filed to store pointer to the compare function. + */ + +/* GUC variables */ +#ifdef TRACE_SORT +extern PGDLLIMPORT bool trace_sort; +#endif + +/* All memory management should be inside Tuplesortstate module. */ +#define USEMEM(state,amt) do {} while(0) + +#else /* PG_VERSION_NUM >= 160000 */ /* * We need extra field in a state structure but we should not modify struct * RumTuplesortstate which is inherited from Tuplesortstate core function. @@ -55,6 +77,7 @@ typedef struct RumTuplesortstateExt RumTuplesortstate ts; FmgrInfo *cmp; } RumTuplesortstateExt; +#endif /* PG_VERSION_NUM < 160000 */ static int comparetup_rum(const SortTuple *a, const SortTuple *b, RumTuplesortstate *state, bool compareItemPointer); @@ -70,12 +93,18 @@ static void copytup_rumitem(RumTuplesortstate *state, SortTuple *stup, static void *rum_tuplesort_getrum_internal(RumTuplesortstate *state, bool forward, bool *should_free); +/* + * Tuplesortstate handling should be done through this macro. + */ #if PG_VERSION_NUM >= 160000 # define TSS_GET(state) TuplesortstateGetPublic((state)) #else # define TSS_GET(state) (state) #endif +/* + * Logical tape handling should be done through this macro. + */ #if PG_VERSION_NUM >= 150000 #define LT_TYPE LogicalTape * #define LT_ARG tape @@ -86,6 +115,25 @@ static void *rum_tuplesort_getrum_internal(RumTuplesortstate *state, #define TAPE(state, LT_ARG) state->tapeset, LT_ARG #endif +/* + * Just for convenience and uniformity. + */ +#if PG_VERSION_NUM >= 110000 +#define tuplesort_begin_common(x,y) tuplesort_begin_common((x), NULL, (y)) +#endif + +/* + * Trace log wrapper. + */ +#ifdef TRACE_SORT +# define LOG_SORT(...) \ + if (trace_sort) \ + ereport(LOG, errmsg_internal(__VA_ARGS__)) +#else +# define LOG_SORT(...) \ + {} +#endif + static inline int compare_rum_itempointer(ItemPointerData p1, ItemPointerData p2) { @@ -156,19 +204,29 @@ comparetup_rum_false(const SortTuple *a, const SortTuple *b, return comparetup_rum(a, b, state, false); } +static inline FmgrInfo * +comparetup_rumitem_custom_fun(RumTuplesortstate *state) +{ +#if PG_VERSION_NUM >= 160000 + return (FmgrInfo *) TSS_GET(state)->arg; +#else + return ((RumTuplesortstateExt *) state)->cmp; +#endif +} + static int comparetup_rumitem(const SortTuple *a, const SortTuple *b, RumTuplesortstate *state) { - RumItem *i1, - *i2; - FmgrInfo *cmp; + RumItem *i1, + *i2; + FmgrInfo *cmp; /* Extract RumItem from RumScanItem */ i1 = (RumItem *) a->tuple; i2 = (RumItem *) b->tuple; - cmp = ((RumTuplesortstateExt *) state)->cmp; + cmp = comparetup_rumitem_custom_fun(state); if (cmp != NULL) { if (i1->addInfoIsNull || i2->addInfoIsNull) @@ -242,17 +300,21 @@ writetup_rum_internal(RumTuplesortstate *state, LT_TYPE LT_ARG, void *item = stup->tuple; size_t size = rum_item_size(state); unsigned int writtenlen = size + sizeof(unsigned int); + bool randomAccess; LogicalTapeWrite(TAPE(state, LT_ARG), (void *) &writtenlen, sizeof(writtenlen)); LogicalTapeWrite(TAPE(state, LT_ARG), (void *) item, size); -#if PG_VERSION_NUM >= 150000 - if (TSS_GET(state)->sortopt & TUPLESORT_RANDOMACCESS) /* need trailing - * length word? */ -#else - if (TSS_GET(state)->randomAccess) /* need trailing length word? */ -#endif + + randomAccess = +# if PG_VERSION_NUM >= 150000 + (TSS_GET(state)->sortopt & TUPLESORT_RANDOMACCESS) != 0; +# else + TSS_GET(state)->randomAccess; +# endif + + if (randomAccess) LogicalTapeWrite(TAPE(TSS_GET(state), LT_ARG), (void *) &writtenlen, sizeof(writtenlen)); } @@ -280,6 +342,7 @@ readtup_rum_internal(RumTuplesortstate *state, SortTuple *stup, Assert(tuplen == size); USEMEM(state, GetMemoryChunkSpace(item)); + #if PG_VERSION_NUM >= 150000 LogicalTapeReadExact(LT_ARG, item, size); #else @@ -316,10 +379,6 @@ readtup_rumitem(RumTuplesortstate *state, SortTuple *stup, LT_TYPE LT_ARG, readtup_rum_internal(state, stup, LT_ARG, len, true); } -#if PG_VERSION_NUM >= 110000 -#define tuplesort_begin_common(x,y) tuplesort_begin_common((x), NULL, (y)) -#endif - RumTuplesortstate * rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess, bool compareItemPointer) @@ -336,12 +395,8 @@ rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess, oldcontext = MemoryContextSwitchTo(TSS_GET(state)->sortcontext); -#ifdef TRACE_SORT - if (trace_sort) - elog(LOG, - "begin rum sort: nKeys = %d, workMem = %d, randomAccess = %c", + LOG_SORT("begin rum sort: nKeys = %d, workMem = %d, randomAccess = %c", nKeys, workMem, randomAccess ? 't' : 'f'); -#endif TSS_GET(state)->nKeys = nKeys; TSS_GET(state)->comparetup = compareItemPointer ? comparetup_rum_true : @@ -357,6 +412,23 @@ rum_tuplesort_begin_rum(int workMem, int nKeys, bool randomAccess, RumTuplesortstate * rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) { +#if PG_VERSION_NUM >= 160000 + RumTuplesortstate *state = tuplesort_begin_common(workMem, false); + MemoryContext oldcontext; + + oldcontext = MemoryContextSwitchTo(TSS_GET(state)->sortcontext); + + LOG_SORT("begin rumitem sort: workMem = %d", workMem); + + TSS_GET(state)->comparetup = comparetup_rumitem; + TSS_GET(state)->writetup = writetup_rumitem; + TSS_GET(state)->readtup = readtup_rumitem; + TSS_GET(state)->arg = cmp; + + MemoryContextSwitchTo(oldcontext); + + return state; +#else RumTuplesortstate *state = tuplesort_begin_common(workMem, false); RumTuplesortstateExt *rs; MemoryContext oldcontext; @@ -366,11 +438,7 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) /* Allocate extended state in the same context as state */ rs = palloc(sizeof(*rs)); -#ifdef TRACE_SORT - if (trace_sort) - elog(LOG, - "begin rumitem sort: workMem = %d", workMem); -#endif + LOG_SORT("begin rumitem sort: workMem = %d", workMem); rs->cmp = cmp; TSS_GET(state)->comparetup = comparetup_rumitem; @@ -383,6 +451,7 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) MemoryContextSwitchTo(oldcontext); return (RumTuplesortstate *) rs; +#endif } /* @@ -397,7 +466,7 @@ rum_tuplesort_begin_rumitem(int workMem, FmgrInfo *cmp) void rum_tuplesort_end(RumTuplesortstate *state) { -#if PG_VERSION_NUM >= 130000 +#if PG_VERSION_NUM < 160000 && PG_VERSION_NUM >= 130000 tuplesort_free(state); #else tuplesort_end(state); diff --git a/src/tuplesort16.c b/src/tuplesort16.c deleted file mode 100644 index 694d8f1a83..0000000000 --- a/src/tuplesort16.c +++ /dev/null @@ -1,307 +0,0 @@ -/*------------------------------------------------------------------------- - * - * tuplesort16.c - * This file is a copy-paste from src/backend/utils/sort/tuplesort.c - * - * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group - * Portions Copyright (c) 1994, Regents of the University of California - * - * IDENTIFICATION - * rum/tuplesort16.c - * - *------------------------------------------------------------------------- - */ - -#include "postgres.h" - -#include - -#include "catalog/pg_am.h" -#include "commands/tablespace.h" -#include "executor/executor.h" -#include "miscadmin.h" -#include "pg_trace.h" -#include "storage/shmem.h" -#include "utils/memutils.h" -#include "utils/pg_rusage.h" -#include "utils/rel.h" -#include "utils/tuplesort.h" - -/* GUC variables */ -#ifdef TRACE_SORT -bool trace_sort = false; -#endif - -/* - * During merge, we use a pre-allocated set of fixed-size slots to hold - * tuples. To avoid palloc/pfree overhead. - * - * Merge doesn't require a lot of memory, so we can afford to waste some, - * by using gratuitously-sized slots. If a tuple is larger than 1 kB, the - * palloc() overhead is not significant anymore. - * - * 'nextfree' is valid when this chunk is in the free list. When in use, the - * slot holds a tuple. - */ -#define SLAB_SLOT_SIZE 1024 - -typedef union SlabSlot -{ - union SlabSlot *nextfree; - char buffer[SLAB_SLOT_SIZE]; -} SlabSlot; - -/* - * Possible states of a Tuplesort object. These denote the states that - * persist between calls of Tuplesort routines. - */ -typedef enum -{ - TSS_INITIAL, /* Loading tuples; still within memory limit */ - TSS_BOUNDED, /* Loading tuples into bounded-size heap */ - TSS_BUILDRUNS, /* Loading tuples; writing to tape */ - TSS_SORTEDINMEM, /* Sort completed entirely in memory */ - TSS_SORTEDONTAPE, /* Sort completed, final run is on tape */ - TSS_FINALMERGE /* Performing final merge on-the-fly */ -} TupSortStatus; - -/* - * Parameters for calculation of number of tapes to use --- see inittapes() - * and tuplesort_merge_order(). - * - * In this calculation we assume that each tape will cost us about 1 blocks - * worth of buffer space. This ignores the overhead of all the other data - * structures needed for each tape, but it's probably close enough. - * - * MERGE_BUFFER_SIZE is how much buffer space we'd like to allocate for each - * input tape, for pre-reading (see discussion at top of file). This is *in - * addition to* the 1 block already included in TAPE_BUFFER_OVERHEAD. - */ -#define MINORDER 6 /* minimum merge order */ -#define MAXORDER 500 /* maximum merge order */ -#define TAPE_BUFFER_OVERHEAD BLCKSZ -#define MERGE_BUFFER_SIZE (BLCKSZ * 32) - - -/* - * Private state of a Tuplesort operation. - */ -struct Tuplesortstate -{ - TuplesortPublic base; - TupSortStatus status; /* enumerated value as shown above */ - bool bounded; /* did caller specify a maximum number of - * tuples to return? */ - bool boundUsed; /* true if we made use of a bounded heap */ - int bound; /* if bounded, the maximum number of tuples */ - int64 availMem; /* remaining memory available, in bytes */ - int64 allowedMem; /* total memory allowed, in bytes */ - int maxTapes; /* max number of input tapes to merge in each - * pass */ - int64 maxSpace; /* maximum amount of space occupied among sort - * of groups, either in-memory or on-disk */ - bool isMaxSpaceDisk; /* true when maxSpace is value for on-disk - * space, false when it's value for in-memory - * space */ - TupSortStatus maxSpaceStatus; /* sort status when maxSpace was reached */ - LogicalTapeSet *tapeset; /* logtape.c object for tapes in a temp file */ - - /* - * 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 - * SORTEDINMEM, the tuples are in final sorted order; in states BUILDRUNS - * and FINALMERGE, the tuples are organized in "heap" order per Algorithm - * H. In state SORTEDONTAPE, the array is not used. - */ - SortTuple *memtuples; /* array of SortTuple structs */ - int memtupcount; /* number of tuples currently present */ - int memtupsize; /* allocated length of memtuples array */ - bool growmemtuples; /* memtuples' growth still underway? */ - - /* - * Memory for tuples is sometimes allocated using a simple slab allocator, - * rather than with palloc(). Currently, we switch to slab allocation - * when we start merging. Merging only needs to keep a small, fixed - * number of tuples in memory at any time, so we can avoid the - * palloc/pfree overhead by recycling a fixed number of fixed-size slots - * to hold the tuples. - * - * For the slab, we use one large allocation, divided into SLAB_SLOT_SIZE - * slots. The allocation is sized to have one slot per tape, plus one - * additional slot. We need that many slots to hold all the tuples kept - * in the heap during merge, plus the one we have last returned from the - * sort, with tuplesort_gettuple. - * - * Initially, all the slots are kept in a linked list of free slots. When - * a tuple is read from a tape, it is put to the next available slot, if - * it fits. If the tuple is larger than SLAB_SLOT_SIZE, it is palloc'd - * instead. - * - * When we're done processing a tuple, we return the slot back to the free - * list, or pfree() if it was palloc'd. We know that a tuple was - * allocated from the slab, if its pointer value is between - * slabMemoryBegin and -End. - * - * When the slab allocator is used, the USEMEM/LACKMEM mechanism of - * tracking memory usage is not used. - */ - bool slabAllocatorUsed; - - char *slabMemoryBegin; /* beginning of slab memory arena */ - char *slabMemoryEnd; /* end of slab memory arena */ - SlabSlot *slabFreeHead; /* head of free list */ - - /* Memory used for input and output tape buffers. */ - size_t tape_buffer_mem; - - /* - * When we return a tuple to the caller in tuplesort_gettuple_XXX, that - * came from a tape (that is, in TSS_SORTEDONTAPE or TSS_FINALMERGE - * modes), we remember the tuple in 'lastReturnedTuple', so that we can - * recycle the memory on next gettuple call. - */ - void *lastReturnedTuple; - - /* - * While building initial runs, this is the current output run number. - * Afterwards, it is the number of initial runs we made. - */ - int currentRun; - - /* - * Logical tapes, for merging. - * - * The initial runs are written in the output tapes. In each merge pass, - * the output tapes of the previous pass become the input tapes, and new - * output tapes are created as needed. When nInputTapes equals - * nInputRuns, there is only one merge pass left. - */ - LogicalTape **inputTapes; - int nInputTapes; - int nInputRuns; - - LogicalTape **outputTapes; - int nOutputTapes; - int nOutputRuns; - - LogicalTape *destTape; /* current output tape */ - - /* - * These variables are used after completion of sorting to keep track of - * the next tuple to return. (In the tape case, the tape's current read - * position is also critical state.) - */ - LogicalTape *result_tape; /* actual tape of finished output */ - int current; /* array index (only used if SORTEDINMEM) */ - bool eof_reached; /* reached EOF (needed for cursors) */ - - /* markpos_xxx holds marked position for mark and restore */ - long markpos_block; /* tape block# (only used if SORTEDONTAPE) */ - int markpos_offset; /* saved "current", or offset in tape block */ - bool markpos_eof; /* saved "eof_reached" */ - - /* - * These variables are used during parallel sorting. - * - * worker is our worker identifier. Follows the general convention that - * -1 value relates to a leader tuplesort, and values >= 0 worker - * tuplesorts. (-1 can also be a serial tuplesort.) - * - * shared is mutable shared memory state, which is used to coordinate - * parallel sorts. - * - * nParticipants is the number of worker Tuplesortstates known by the - * leader to have actually been launched, which implies that they must - * finish a run that the leader needs to merge. Typically includes a - * worker state held by the leader process itself. Set in the leader - * Tuplesortstate only. - */ - int worker; - Sharedsort *shared; - int nParticipants; - - /* - * Additional state for managing "abbreviated key" sortsupport routines - * (which currently may be used by all cases except the hash index case). - * Tracks the intervals at which the optimization's effectiveness is - * tested. - */ - int64 abbrevNext; /* Tuple # at which to next check - * applicability */ - - /* - * Resource snapshot for time of sort start. - */ -#ifdef TRACE_SORT - PGRUsage ru_start; -#endif -}; - -#define FREESTATE(state) ((state)->base.freestate ? (*(state)->base.freestate) (state) : (void) 0) -#define USEMEM(state,amt) ((state)->availMem -= (amt)) -#define SERIAL(state) ((state)->shared == NULL) - -/* - * tuplesort_free - * - * Internal routine for freeing resources of tuplesort. - */ -static void -tuplesort_free(Tuplesortstate *state) -{ - /* context swap probably not needed, but let's be safe */ - MemoryContext oldcontext = MemoryContextSwitchTo(state->base.sortcontext); - -#ifdef TRACE_SORT - long spaceUsed; - - if (state->tapeset) - spaceUsed = LogicalTapeSetBlocks(state->tapeset); - else - spaceUsed = (state->allowedMem - state->availMem + 1023) / 1024; -#endif - - /* - * Delete temporary "tape" files, if any. - * - * Note: want to include this in reported total cost of sort, hence need - * for two #ifdef TRACE_SORT sections. - * - * We don't bother to destroy the individual tapes here. They will go away - * with the sortcontext. (In TSS_FINALMERGE state, we have closed - * finished tapes already.) - */ - if (state->tapeset) - LogicalTapeSetClose(state->tapeset); - -#ifdef TRACE_SORT - if (trace_sort) - { - if (state->tapeset) - elog(LOG, "%s of worker %d ended, %ld disk blocks used: %s", - SERIAL(state) ? "external sort" : "parallel external sort", - state->worker, spaceUsed, pg_rusage_show(&state->ru_start)); - else - elog(LOG, "%s of worker %d ended, %ld KB used: %s", - SERIAL(state) ? "internal sort" : "unperformed parallel sort", - state->worker, spaceUsed, pg_rusage_show(&state->ru_start)); - } - - TRACE_POSTGRESQL_SORT_DONE(state->tapeset != NULL, spaceUsed); -#else - - /* - * If you disabled TRACE_SORT, you can still probe sort__done, but you - * ain't getting space-used stats. - */ - TRACE_POSTGRESQL_SORT_DONE(state->tapeset != NULL, 0L); -#endif - - FREESTATE(state); - MemoryContextSwitchTo(oldcontext); - - /* - * Free the per-sort memory context, thereby releasing all working memory. - */ - MemoryContextReset(state->base.sortcontext); -} From 775de3bc1af14d53f9f6d4dd7882f96c7187cb84 Mon Sep 17 00:00:00 2001 From: Jacqui Shadforth Date: Sun, 18 Sep 2022 20:22:07 +0100 Subject: [PATCH 13/47] Update README with small language tweaks --- README.md | 67 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 667e1a3586..5f3e6887cf 100644 --- a/README.md +++ b/README.md @@ -8,38 +8,38 @@ ## Introduction -The **rum** module provides access method to work with `RUM` index. It is based -on the `GIN` access methods code. +The **rum** module provides an access method to work with a `RUM` index. It is based +on the `GIN` access method's code. -`GIN` index allows to perform fast full text search using `tsvector` and -`tsquery` types. But full text search with GIN index has several problems: +A `GIN` index allows performing fast full-text search using `tsvector` and +`tsquery` types. But full-text search with a GIN index has several problems: -- Slow ranking. It is need position information about lexems to ranking. `GIN` -index doesn't store positions of lexems. So after index scan we need additional -heap scan to retrieve lexems positions. -- Slow phrase search with `GIN` index. This problem relates with previous -problem. It is need position information to perform phrase search. -- Slow ordering by timestamp. `GIN` index can't store some related information -in index with lexemes. So it is necessary to perform additional heap scan. +- Slow ranking. It needs positional information about lexemes to do ranking. A `GIN` +index doesn't store positions of lexemes. So after index scanning, we need an +additional heap scan to retrieve lexeme positions. +- Slow phrase search with a `GIN` index. This problem relates to the previous +problem. It needs positional information to perform phrase search. +- Slow ordering by timestamp. A `GIN` index can't store some related information +in the index with lexemes. So it is necessary to perform an additional heap scan. -`RUM` solves this problems by storing additional information in posting tree. +`RUM` solves these problems by storing additional information in a posting tree. For example, positional information of lexemes or timestamps. You can get an -idea of `RUM` by the following picture: +idea of `RUM` with the following diagram: ![How RUM stores additional information](img/gin_rum.png) -Drawback of `RUM` is that it has slower build and insert time than `GIN`. -It is because we need to store additional information besides keys and because -`RUM` uses generic WAL records. +A drawback of `RUM` is that it has slower build and insert times than `GIN`. +This is because we need to store additional information besides keys and because +`RUM` uses generic Write-Ahead Log (WAL) records. ## License -This module available under the [license](LICENSE) similar to +This module is available under the [license](LICENSE) similar to [PostgreSQL](http://www.postgresql.org/about/licence/). ## Installation -Before build and install **rum** you should ensure following: +Before building and installing **rum**, you should ensure following are installed: * PostgreSQL version is 9.6+. @@ -62,7 +62,7 @@ Typical installation procedure may look like this: ## Common operators and functions -**rum** module provides next operators. +The **rum** module provides next operators. | Operator | Returns | Description | -------------------- | ------- | ---------------------------------------------- @@ -71,19 +71,19 @@ Typical installation procedure may look like this: | timestamp <=| timestamp | float8 | Returns distance only for left timestamps. | timestamp |=> timestamp | float8 | Returns distance only for right timestamps. -Last three operations also works for types timestamptz, int2, int4, int8, float4, float8, +The last three operations also work for types timestamptz, int2, int4, int8, float4, float8, money and oid. ## Operator classes -**rum** provides next operator classes. +**rum** provides the following operator classes. ### rum_tsvector_ops For type: `tsvector` -This operator class stores `tsvector` lexemes with positional information. Supports -ordering by `<=>` operator and prefix search. There is the example. +This operator class stores `tsvector` lexemes with positional information. It supports +ordering by the `<=>` operator and prefix search. See the example below. Let us assume we have the table: @@ -140,8 +140,8 @@ SELECT t, a <=> to_tsquery('english', 'place | situation') AS rank For type: `tsvector` -This operator class stores hash of `tsvector` lexemes with positional information. -Supports ordering by `<=>` operator. But **doesn't** support prefix search. +This operator class stores a hash of `tsvector` lexemes with positional information. +It supports ordering by the `<=>` operator. It **doesn't** support prefix search. ### rum_TYPE_ops @@ -153,17 +153,18 @@ Supported operations: `<`, `<=`, `=`, `>=`, `>` for all types and `<=>`, `<=|` and `|=>` for int2, int4, int8, float4, float8, money, oid, timestamp and timestamptz types. -Supports ordering by `<=>`, `<=|` and `|=>` operators. Can be used with +This operator supports ordering by the `<=>`, `<=|` and `|=>` operators. It can be used with `rum_tsvector_addon_ops`, `rum_tsvector_hash_addon_ops' and `rum_anyarray_addon_ops` operator classes. ### rum_tsvector_addon_ops For type: `tsvector` -This operator class stores `tsvector` lexems with any supported by module -field. There is the example. +This operator class stores `tsvector` lexemes with any supported by module +field. See the example below. Let us assume we have the table: + ```sql CREATE TABLE tsts (id int, t tsvector, d timestamp); @@ -202,16 +203,16 @@ SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY For type: `tsvector` -This operator class stores hash of `tsvector` lexems with any supported by module +This operator class stores a hash of `tsvector` lexemes with any supported by module field. -**Doesn't** support prefix search. +It **doesn't** support prefix search. ### rum_tsquery_ops For type: `tsquery` -Stores branches of query tree in additional information. For example we have the table: +It stores branches of query tree in additional information. For example, we have the table: ```sql CREATE TABLE query (q tsquery, tag text); @@ -240,8 +241,8 @@ SELECT * FROM query For type: `anyarray` This operator class stores `anyarray` elements with length of the array. -Supports operators `&&`, `@>`, `<@`, `=`, `%` operators. Supports ordering by `<=>` operator. -For example we have the table: +It supports operators `&&`, `@>`, `<@`, `=`, `%` operators. It also supports ordering by `<=>` operator. +For example, we have the table: ```sql CREATE TABLE test_array (i int2[]); From 43465cba642788d069058d3adf65343e1aedbb1d Mon Sep 17 00:00:00 2001 From: Marina Polyakova Date: Mon, 21 Nov 2022 18:17:48 +0300 Subject: [PATCH 14/47] 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 Date: Mon, 19 Dec 2022 14:33:52 +0300 Subject: [PATCH 15/47] 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 Date: Mon, 19 Dec 2022 14:33:52 +0300 Subject: [PATCH 16/47] 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 Date: Mon, 19 Dec 2022 16:32:11 +0300 Subject: [PATCH 17/47] 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 Date: Fri, 25 Nov 2022 16:40:37 +0300 Subject: [PATCH 18/47] [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 Date: Mon, 4 Jul 2022 16:21:00 +0300 Subject: [PATCH 19/47] [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 Date: Mon, 21 Nov 2022 18:17:48 +0300 Subject: [PATCH 20/47] 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 Date: Tue, 31 Jan 2023 14:56:46 +0700 Subject: [PATCH 21/47] 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 Date: Tue, 14 Feb 2023 18:11:47 +0300 Subject: [PATCH 22/47] 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 Date: Wed, 15 Feb 2023 11:26:38 +0300 Subject: [PATCH 23/47] 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 Date: Wed, 15 Feb 2023 14:36:40 +0300 Subject: [PATCH 24/47] 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 Date: Tue, 3 Oct 2023 23:15:25 +0300 Subject: [PATCH 25/47] [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 Date: Wed, 4 Oct 2023 00:38:42 +0300 Subject: [PATCH 26/47] 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 Date: Wed, 11 Oct 2023 20:33:31 +0300 Subject: [PATCH 27/47] [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 Date: Wed, 18 Oct 2023 02:53:18 +0300 Subject: [PATCH 28/47] [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 29/47] 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 Date: Wed, 23 Oct 2024 15:06:38 +0300 Subject: [PATCH 30/47] 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 Date: Wed, 23 Oct 2024 15:58:29 +0300 Subject: [PATCH 31/47] 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 32/47] 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 33/47] Stabilize array test. (#135) Make this test output more independent of PostgreSQL server version and system. Authored-by: Karina Litskevich --- 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 Date: Wed, 6 Nov 2024 14:28:24 +0300 Subject: [PATCH 34/47] 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 Date: Wed, 11 Dec 2024 19:12:03 +0300 Subject: [PATCH 35/47] 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 Date: Wed, 11 Dec 2024 19:36:13 +0300 Subject: [PATCH 36/47] 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 Date: Tue, 17 Dec 2024 15:01:24 +0300 Subject: [PATCH 37/47] 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=< ( - 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=<= 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=<= 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 <{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 <{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 < ( - 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 Date: Tue, 21 Jan 2025 16:43:46 +0300 Subject: [PATCH 38/47] 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 Date: Thu, 13 Feb 2025 13:00:49 +0700 Subject: [PATCH 39/47] 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 Date: Thu, 3 Oct 2024 10:01:43 +0300 Subject: [PATCH 40/47] [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 e3ddcda49348dac05469bee4c444a93b9c3c7d18 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Tue, 11 Feb 2025 14:03:41 +0300 Subject: [PATCH 41/47] PGPRO-11987 Support new Optimizer's behaviour in regression tests --- expected/altorder.out | 9 +- expected/altorder_1.out | 9 +- expected/altorder_2.out | 598 ++++++++++++++++++++++ expected/altorder_hash.out | 5 + expected/altorder_hash_1.out | 5 + expected/altorder_hash_2.out | 363 ++++++++++++++ expected/array.out | 6 + expected/array_1.out | 6 + expected/array_2.out | 929 +++++++++++++++++++++++++++++++++++ expected/array_3.out | 922 ++++++++++++++++++++++++++++++++++ expected/int8.out | 5 + expected/int8_1.out | 5 + expected/int8_2.out | 701 ++++++++++++++++++++++++++ expected/orderby.out | 78 +-- expected/orderby_1.out | 46 +- expected/orderby_hash.out | 78 +-- expected/orderby_hash_1.out | 46 +- expected/rum.out | 1 + expected/rum_hash.out | 1 + expected/text.out | 12 + expected/text_1.out | 337 +++++++++++++ sql/altorder.sql | 11 +- sql/altorder_hash.sql | 5 + sql/array.sql | 6 + sql/int8.sql | 5 + sql/orderby.sql | 18 +- sql/orderby_hash.sql | 18 +- sql/rum.sql | 1 + sql/rum_hash.sql | 1 + sql/text.sql | 12 + 30 files changed, 4095 insertions(+), 144 deletions(-) create mode 100644 expected/altorder_2.out create mode 100644 expected/altorder_hash_2.out create mode 100644 expected/array_2.out create mode 100644 expected/array_3.out create mode 100644 expected/int8_2.out create mode 100644 expected/text_1.out diff --git a/expected/altorder.out b/expected/altorder.out index 6c0bcae2ad..9f33015ce6 100644 --- a/expected/altorder.out +++ b/expected/altorder.out @@ -3,8 +3,13 @@ * NOTE: This test behaves differenly * ------------------------------------ * - * altorder.out - test output for 64-bit systems and - * altorder_1.out - test output for 32-bit systems. + * altorder.out - test output for 64-bit systems + * altorder_1.out - test output for 32-bit systems + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_2.out - test output for 32-bit systems (>=18) * */ CREATE TABLE atsts (id int, t tsvector, d timestamp); diff --git a/expected/altorder_1.out b/expected/altorder_1.out index 980515f58e..83db595bc0 100644 --- a/expected/altorder_1.out +++ b/expected/altorder_1.out @@ -3,8 +3,13 @@ * NOTE: This test behaves differenly * ------------------------------------ * - * altorder.out - test output for 64-bit systems and - * altorder_1.out - test output for 32-bit systems. + * altorder.out - test output for 64-bit systems + * altorder_1.out - test output for 32-bit systems + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_2.out - test output for 32-bit systems (>=18) * */ CREATE TABLE atsts (id int, t tsvector, d timestamp); diff --git a/expected/altorder_2.out b/expected/altorder_2.out new file mode 100644 index 0000000000..fec9d06d05 --- /dev/null +++ b/expected/altorder_2.out @@ -0,0 +1,598 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * altorder.out - test output for 64-bit systems + * altorder_1.out - test output for 32-bit systems + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_2.out - test output for 32-bit systems (>=18) + * + */ +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 +\copy atsts from 'data/tsts.data' +\copy atsts from 'data/tsts.data' +\copy atsts from 'data/tsts.data' +CREATE INDEX atsts_idx ON atsts USING rum (t rum_tsvector_addon_ops, d) + WITH (attach = 'd', to = 't', order_by_attach='t'); +ERROR: doesn't support order index over pass-by-reference column +INSERT INTO atsts VALUES (-1, 't1 t2', '2016-05-02 02:24:22.326724'); +INSERT INTO atsts VALUES (-2, 't1 t2 t3', '2016-05-02 02:26:22.326724'); +SELECT count(*) FROM atsts WHERE t @@ 'wr|qh'; + count +------- + 632 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ 'wr&qh'; + count +------- + 68 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ 'eq&yt'; + count +------- + 24 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ 'eq|yt'; + count +------- + 392 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ '(eq&yt)|(wr&qh)'; + count +------- + 92 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ '(eq|yt)&(wr|qh)'; + count +------- + 156 +(1 row) + +SET enable_indexscan=OFF; +SET enable_indexonlyscan=OFF; +SET enable_bitmapscan=OFF; +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 +(5 rows) + +SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 +(5 rows) + +SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724 +(5 rows) + +SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25'; + count +------- + 1422 +(1 row) + +SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25'; + count +------- + 612 +(1 row) + +SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 16 | Mon May 02 11:21:22.326724 2016 + 16 | Mon May 02 11:21:22.326724 2016 + 16 | Mon May 02 11:21:22.326724 2016 + 16 | Mon May 02 11:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 +(36 rows) + +SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 +(32 rows) + +-- Test bitmap index scan +SET enable_bitmapscan=on; +SET enable_seqscan = off; +EXPLAIN (costs off) +SELECT count(*) FROM atsts WHERE t @@ 'wr|qh'; + QUERY PLAN +--------------------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: (t @@ '''wr'' | ''qh'''::tsquery) +(5 rows) + +SELECT count(*) FROM atsts WHERE t @@ 'wr|qh'; + count +------- + 632 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ 'wr&qh'; + count +------- + 68 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ 'eq&yt'; + count +------- + 24 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ 'eq|yt'; + count +------- + 392 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ '(eq&yt)|(wr&qh)'; + count +------- + 92 +(1 row) + +SELECT count(*) FROM atsts WHERE t @@ '(eq|yt)&(wr|qh)'; + count +------- + 156 +(1 row) + +EXPLAIN (costs off) +SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25'; + QUERY PLAN +------------------------------------------------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(5 rows) + +SELECT count(*) FROM atsts WHERE d < '2016-05-16 14:21:25'; + count +------- + 1422 +(1 row) + +EXPLAIN (costs off) +SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25'; + QUERY PLAN +------------------------------------------------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(5 rows) + +SELECT count(*) FROM atsts WHERE d > '2016-05-16 14:21:25'; + count +------- + 612 +(1 row) + +-- Test index scan +SET enable_indexscan=on; +SET enable_indexonlyscan=on; +SET enable_bitmapscan=off; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atsts WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atsts + Disabled Nodes: 1 +(7 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------ + Sort + Disabled Nodes: 1 + Sort Key: d + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) +(6 rows) + +SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 16 | Mon May 02 11:21:22.326724 2016 + 16 | Mon May 02 11:21:22.326724 2016 + 16 | Mon May 02 11:21:22.326724 2016 + 16 | Mon May 02 11:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 +(36 rows) + +EXPLAIN (costs off) +SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------ + Sort + Disabled Nodes: 1 + Sort Key: d + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) +(6 rows) + +SELECT id, d FROM atsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 +(32 rows) + +EXPLAIN (costs off) +SELECT id, d FROM atsts WHERE t @@ 'wr&q:*' AND d >= '2016-05-16 14:21:25' ORDER BY d; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: d + -> Seq Scan on atsts + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''q'':*'::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) +(6 rows) + +SELECT id, d FROM atsts WHERE t @@ 'wr&q:*' AND d >= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 361 | Mon May 16 20:21:22.326724 2016 + 361 | Mon May 16 20:21:22.326724 2016 + 361 | Mon May 16 20:21:22.326724 2016 + 361 | Mon May 16 20:21:22.326724 2016 + 369 | Tue May 17 04:21:22.326724 2016 + 369 | Tue May 17 04:21:22.326724 2016 + 369 | Tue May 17 04:21:22.326724 2016 + 369 | Tue May 17 04:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 371 | Tue May 17 06:21:22.326724 2016 + 372 | Tue May 17 07:21:22.326724 2016 + 372 | Tue May 17 07:21:22.326724 2016 + 372 | Tue May 17 07:21:22.326724 2016 + 372 | Tue May 17 07:21:22.326724 2016 + 375 | Tue May 17 10:21:22.326724 2016 + 375 | Tue May 17 10:21:22.326724 2016 + 375 | Tue May 17 10:21:22.326724 2016 + 375 | Tue May 17 10:21:22.326724 2016 + 388 | Tue May 17 23:21:22.326724 2016 + 388 | Tue May 17 23:21:22.326724 2016 + 388 | Tue May 17 23:21:22.326724 2016 + 388 | Tue May 17 23:21:22.326724 2016 + 405 | Wed May 18 16:21:22.326724 2016 + 405 | Wed May 18 16:21:22.326724 2016 + 405 | Wed May 18 16:21:22.326724 2016 + 405 | Wed May 18 16:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 422 | Thu May 19 09:21:22.326724 2016 + 422 | Thu May 19 09:21:22.326724 2016 + 422 | Thu May 19 09:21:22.326724 2016 + 422 | Thu May 19 09:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 441 | Fri May 20 04:21:22.326724 2016 + 441 | Fri May 20 04:21:22.326724 2016 + 441 | Fri May 20 04:21:22.326724 2016 + 441 | Fri May 20 04:21:22.326724 2016 + 444 | Fri May 20 07:21:22.326724 2016 + 444 | Fri May 20 07:21:22.326724 2016 + 444 | Fri May 20 07:21:22.326724 2016 + 444 | Fri May 20 07:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 463 | Sat May 21 02:21:22.326724 2016 + 463 | Sat May 21 02:21:22.326724 2016 + 463 | Sat May 21 02:21:22.326724 2016 + 463 | Sat May 21 02:21:22.326724 2016 + 465 | Sat May 21 04:21:22.326724 2016 + 465 | Sat May 21 04:21:22.326724 2016 + 465 | Sat May 21 04:21:22.326724 2016 + 465 | Sat May 21 04:21:22.326724 2016 + 466 | Sat May 21 05:21:22.326724 2016 + 466 | Sat May 21 05:21:22.326724 2016 + 466 | Sat May 21 05:21:22.326724 2016 + 466 | Sat May 21 05:21:22.326724 2016 + 468 | Sat May 21 07:21:22.326724 2016 + 468 | Sat May 21 07:21:22.326724 2016 + 468 | Sat May 21 07:21:22.326724 2016 + 468 | Sat May 21 07:21:22.326724 2016 + 471 | Sat May 21 10:21:22.326724 2016 + 471 | Sat May 21 10:21:22.326724 2016 + 471 | Sat May 21 10:21:22.326724 2016 + 471 | Sat May 21 10:21:22.326724 2016 + 475 | Sat May 21 14:21:22.326724 2016 + 475 | Sat May 21 14:21:22.326724 2016 + 475 | Sat May 21 14:21:22.326724 2016 + 475 | Sat May 21 14:21:22.326724 2016 + 481 | Sat May 21 20:21:22.326724 2016 + 481 | Sat May 21 20:21:22.326724 2016 + 481 | Sat May 21 20:21:22.326724 2016 + 481 | Sat May 21 20:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 485 | Sun May 22 00:21:22.326724 2016 + 485 | Sun May 22 00:21:22.326724 2016 + 485 | Sun May 22 00:21:22.326724 2016 + 485 | Sun May 22 00:21:22.326724 2016 + 493 | Sun May 22 08:21:22.326724 2016 + 493 | Sun May 22 08:21:22.326724 2016 + 493 | Sun May 22 08:21:22.326724 2016 + 493 | Sun May 22 08:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 + 499 | Sun May 22 14:21:22.326724 2016 + 499 | Sun May 22 14:21:22.326724 2016 + 499 | Sun May 22 14:21:22.326724 2016 + 499 | Sun May 22 14:21:22.326724 2016 + 506 | Sun May 22 21:21:22.326724 2016 + 506 | Sun May 22 21:21:22.326724 2016 + 506 | Sun May 22 21:21:22.326724 2016 + 506 | Sun May 22 21:21:22.326724 2016 +(112 rows) + diff --git a/expected/altorder_hash.out b/expected/altorder_hash.out index 1011b90d0c..eb70f9647c 100644 --- a/expected/altorder_hash.out +++ b/expected/altorder_hash.out @@ -6,6 +6,11 @@ * altorder_hash.out - test output for 64-bit systems and * altorder_hash_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_hash_2.out - test output for 32-bit systems (>=18) + * */ CREATE TABLE atstsh (id int, t tsvector, d timestamp); \copy atstsh from 'data/tsts.data' diff --git a/expected/altorder_hash_1.out b/expected/altorder_hash_1.out index e310fbdb89..d45f699c39 100644 --- a/expected/altorder_hash_1.out +++ b/expected/altorder_hash_1.out @@ -6,6 +6,11 @@ * altorder_hash.out - test output for 64-bit systems and * altorder_hash_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_hash_2.out - test output for 32-bit systems (>=18) + * */ CREATE TABLE atstsh (id int, t tsvector, d timestamp); \copy atstsh from 'data/tsts.data' diff --git a/expected/altorder_hash_2.out b/expected/altorder_hash_2.out new file mode 100644 index 0000000000..90dfb3a6ba --- /dev/null +++ b/expected/altorder_hash_2.out @@ -0,0 +1,363 @@ +/* + * ------------------------------------ + * 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. + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_hash_2.out - test output for 32-bit systems (>=18) + * + */ +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) + WITH (attach = 'd', to = 't', order_by_attach='t'); +ERROR: doesn't support order index over pass-by-reference column +INSERT INTO atstsh VALUES (-1, 't1 t2', '2016-05-02 02:24:22.326724'); +INSERT INTO atstsh VALUES (-2, 't1 t2 t3', '2016-05-02 02:26:22.326724'); +SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh'; + count +------- + 158 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ 'wr&qh'; + count +------- + 17 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ 'eq&yt'; + count +------- + 6 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ 'eq|yt'; + count +------- + 98 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ '(eq&yt)|(wr&qh)'; + count +------- + 23 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ '(eq|yt)&(wr|qh)'; + count +------- + 39 +(1 row) + +SET enable_indexscan=OFF; +SET enable_indexonlyscan=OFF; +SET enable_bitmapscan=OFF; +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724 + 415 | Thu May 19 02:21:22.326724 2016 | 215997.326724 +(5 rows) + +SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 252 | Thu May 12 07:21:22.326724 2016 | 370802.673276 + 232 | Wed May 11 11:21:22.326724 2016 | 442802.673276 + 168 | Sun May 08 19:21:22.326724 2016 | 673202.673276 +(5 rows) + +SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724 + 415 | Thu May 19 02:21:22.326724 2016 | 215997.326724 + 428 | Thu May 19 15:21:22.326724 2016 | 262797.326724 + 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 +(5 rows) + +SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25'; + count +------- + 357 +(1 row) + +SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25'; + count +------- + 153 +(1 row) + +SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 16 | Mon May 02 11:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 +(9 rows) + +SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 371 | Tue May 17 06:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 +(8 rows) + +-- Test bitmap index scan +SET enable_bitmapscan=on; +SET enable_seqscan = off; +EXPLAIN (costs off) +SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh'; + QUERY PLAN +--------------------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: (t @@ '''wr'' | ''qh'''::tsquery) +(5 rows) + +SELECT count(*) FROM atstsh WHERE t @@ 'wr|qh'; + count +------- + 158 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ 'wr&qh'; + count +------- + 17 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ 'eq&yt'; + count +------- + 6 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ 'eq|yt'; + count +------- + 98 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ '(eq&yt)|(wr&qh)'; + count +------- + 23 +(1 row) + +SELECT count(*) FROM atstsh WHERE t @@ '(eq|yt)&(wr|qh)'; + count +------- + 39 +(1 row) + +EXPLAIN (costs off) +SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25'; + QUERY PLAN +------------------------------------------------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: (d < 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(5 rows) + +SELECT count(*) FROM atstsh WHERE d < '2016-05-16 14:21:25'; + count +------- + 357 +(1 row) + +EXPLAIN (costs off) +SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25'; + QUERY PLAN +------------------------------------------------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: (d > 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(5 rows) + +SELECT count(*) FROM atstsh WHERE d > '2016-05-16 14:21:25'; + count +------- + 153 +(1 row) + +-- Test index scan +SET enable_indexscan=on; +SET enable_indexonlyscan=on; +SET enable_bitmapscan=off; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724 + 415 | Thu May 19 02:21:22.326724 2016 | 215997.326724 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=| 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, d, d <=| '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d <=| '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 252 | Thu May 12 07:21:22.326724 2016 | 370802.673276 + 232 | Wed May 11 11:21:22.326724 2016 | 442802.673276 + 168 | Sun May 08 19:21:22.326724 2016 | 673202.673276 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d |=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, d, d |=> '2016-05-16 14:21:25' FROM atstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+--------------- + 371 | Tue May 17 06:21:22.326724 2016 | 57597.326724 + 406 | Wed May 18 17:21:22.326724 2016 | 183597.326724 + 415 | Thu May 19 02:21:22.326724 2016 | 215997.326724 + 428 | Thu May 19 15:21:22.326724 2016 | 262797.326724 + 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +------------------------------------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone)) + -> Seq Scan on atstsh + Disabled Nodes: 1 +(7 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM atstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + +EXPLAIN (costs off) +SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------ + Sort + Disabled Nodes: 1 + Sort Key: d + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d <= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) +(6 rows) + +SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 16 | Mon May 02 11:21:22.326724 2016 + 39 | Tue May 03 10:21:22.326724 2016 + 71 | Wed May 04 18:21:22.326724 2016 + 135 | Sat May 07 10:21:22.326724 2016 + 168 | Sun May 08 19:21:22.326724 2016 + 232 | Wed May 11 11:21:22.326724 2016 + 252 | Thu May 12 07:21:22.326724 2016 + 354 | Mon May 16 13:21:22.326724 2016 + 355 | Mon May 16 14:21:22.326724 2016 +(9 rows) + +EXPLAIN (costs off) +SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; + QUERY PLAN +------------------------------------------------------------------------------------------------------------------------ + Sort + Disabled Nodes: 1 + Sort Key: d + -> Seq Scan on atstsh + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (d >= 'Mon May 16 14:21:25 2016'::timestamp without time zone)) +(6 rows) + +SELECT id, d FROM atstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; + id | d +-----+--------------------------------- + 371 | Tue May 17 06:21:22.326724 2016 + 406 | Wed May 18 17:21:22.326724 2016 + 415 | Thu May 19 02:21:22.326724 2016 + 428 | Thu May 19 15:21:22.326724 2016 + 457 | Fri May 20 20:21:22.326724 2016 + 458 | Fri May 20 21:21:22.326724 2016 + 484 | Sat May 21 23:21:22.326724 2016 + 496 | Sun May 22 11:21:22.326724 2016 +(8 rows) + diff --git a/expected/array.out b/expected/array.out index a2fb3bb8df..3d65d7e899 100644 --- a/expected/array.out +++ b/expected/array.out @@ -6,6 +6,12 @@ * array.out - test output for 64-bit systems and * array_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * array_2.out - test output for 64-bit systems (>=18). + * array_3.out - test output for 32-bit systems (>=18). + * */ set enable_seqscan=off; set enable_sort=off; diff --git a/expected/array_1.out b/expected/array_1.out index cc5f93307c..b7fd610f69 100644 --- a/expected/array_1.out +++ b/expected/array_1.out @@ -6,6 +6,12 @@ * array.out - test output for 64-bit systems and * array_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * array_2.out - test output for 64-bit systems (>=18). + * array_3.out - test output for 32-bit systems (>=18). + * */ 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..fc1cd35a83 --- /dev/null +++ b/expected/array_2.out @@ -0,0 +1,929 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * array.out - test output for 64-bit systems and + * array_1.out - test output for 32-bit systems. + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * array_2.out - test output for 64-bit systems (>=18). + * array_3.out - test output for 32-bit systems (>=18). + * + */ +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 + Disabled Nodes: 1 + Filter: (i % '{}'::smallint[]) +(3 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 + * + * 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 + 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 + 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; + i | distance +---------------------+------------------ + {20,23,51} | 1.73205080756888 + {33,51,20,77,23,65} | 2.44948974278318 + {-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_3.out b/expected/array_3.out new file mode 100644 index 0000000000..c73bd00bcc --- /dev/null +++ b/expected/array_3.out @@ -0,0 +1,922 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * array.out - test output for 64-bit systems and + * array_1.out - test output for 32-bit systems. + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * array_2.out - test output for 64-bit systems (>=18). + * array_3.out - test output for 32-bit systems (>=18). + * + */ +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 + Disabled Nodes: 1 + Filter: (i % '{}'::smallint[]) +(3 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 + * + * 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 + 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 + 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; + i | distance +---------------------+------------------ + {20,23,51} | 1.73205080756888 + {33,51,20,77,23,65} | 2.44948974278318 + {-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/int8.out b/expected/int8.out index 663162a18e..51c9d0deaf 100644 --- a/expected/int8.out +++ b/expected/int8.out @@ -6,6 +6,11 @@ * int8.out - test output for 64-bit systems and * int8_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * int8_2.out - test output for 32-bit systems (>=18) + * */ set enable_seqscan=off; CREATE TABLE test_int8 ( diff --git a/expected/int8_1.out b/expected/int8_1.out index ffced0aaf8..41a3b35406 100644 --- a/expected/int8_1.out +++ b/expected/int8_1.out @@ -6,6 +6,11 @@ * int8.out - test output for 64-bit systems and * int8_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * int8_2.out - test output for 32-bit systems (>=18) + * */ set enable_seqscan=off; CREATE TABLE test_int8 ( diff --git a/expected/int8_2.out b/expected/int8_2.out new file mode 100644 index 0000000000..9a2015eae3 --- /dev/null +++ b/expected/int8_2.out @@ -0,0 +1,701 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * int8.out - test output for 64-bit systems and + * int8_1.out - test output for 32-bit systems. + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * int8_2.out - test output for 32-bit systems (>=18) + * + */ +set enable_seqscan=off; +CREATE TABLE test_int8 ( + i int8 +); +INSERT INTO test_int8 VALUES (-2),(-1),(0),(1),(2),(3); +CREATE INDEX idx_int8 ON test_int8 USING rum (i); +SELECT * FROM test_int8 WHERE i<1::int8 ORDER BY i; + i +---- + -2 + -1 + 0 +(3 rows) + +SELECT * FROM test_int8 WHERE i<=1::int8 ORDER BY i; + i +---- + -2 + -1 + 0 + 1 +(4 rows) + +SELECT * FROM test_int8 WHERE i=1::int8 ORDER BY i; + i +--- + 1 +(1 row) + +SELECT * FROM test_int8 WHERE i>=1::int8 ORDER BY i; + i +--- + 1 + 2 + 3 +(3 rows) + +SELECT * FROM test_int8 WHERE i>1::int8 ORDER BY i; + i +--- + 2 + 3 +(2 rows) + +EXPLAIN (costs off) +SELECT *, i <=> 0::int8 FROM test_int8 ORDER BY i <=> 0::int8; + QUERY PLAN +---------------------------------------- + Index Scan using idx_int8 on test_int8 + Order By: (i <=> '0'::bigint) +(2 rows) + +SELECT *, i <=> 0::int8 FROM test_int8 ORDER BY i <=> 0::int8; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT *, i <=> 1::int8 FROM test_int8 WHERE i<1::int8 ORDER BY i <=> 1::int8; + QUERY PLAN +---------------------------------------- + Index Scan using idx_int8 on test_int8 + Index Cond: (i < '1'::bigint) + Order By: (i <=> '1'::bigint) +(3 rows) + +SELECT *, i <=> 1::int8 FROM test_int8 WHERE i<1::int8 ORDER BY i <=> 1::int8; +ERROR: doesn't support order by over pass-by-reference column +CREATE TABLE test_int8_o AS SELECT id::int8, t FROM tsts; +CREATE INDEX test_int8_o_idx ON test_int8_o USING rum + (t rum_tsvector_addon_ops, id) + WITH (attach = 'id', to = 't'); +RESET enable_seqscan; +SET enable_indexscan=OFF; +SET enable_indexonlyscan=OFF; +SET enable_bitmapscan=OFF; +SELECT id, id <=> 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 371 | 29 + 355 | 45 +(5 rows) + +SELECT id, id <=| 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + id | ?column? +-----+---------- + 371 | 29 + 355 | 45 + 354 | 46 + 252 | 148 + 232 | 168 +(5 rows) + +SELECT id, id |=> 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 457 | 57 + 458 | 58 +(5 rows) + +SELECT id FROM test_int8_o WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + id +----- + 16 + 39 + 71 + 135 + 168 + 232 + 252 + 354 + 355 + 371 +(10 rows) + +SELECT id FROM test_int8_o WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 +(7 rows) + +RESET enable_indexscan; +RESET enable_indexonlyscan; +SET enable_seqscan = off; +EXPLAIN (costs off) +SELECT id, id <=> 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + QUERY PLAN +------------------------------------------------------- + Limit + -> Index Scan using test_int8_o_idx on test_int8_o + Index Cond: (t @@ '''wr'' & ''qh'''::tsquery) + Order By: (id <=> '400'::bigint) +(4 rows) + +SELECT id, id <=> 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT id, id <=| 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + QUERY PLAN +------------------------------------------------------- + Limit + -> Index Scan using test_int8_o_idx on test_int8_o + Index Cond: (t @@ '''wr'' & ''qh'''::tsquery) + Order By: (id <=| '400'::bigint) +(4 rows) + +SELECT id, id <=| 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT id, id |=> 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + QUERY PLAN +------------------------------------------------------- + Limit + -> Index Scan using test_int8_o_idx on test_int8_o + Index Cond: (t @@ '''wr'' & ''qh'''::tsquery) + Order By: (id |=> '400'::bigint) +(4 rows) + +SELECT id, id |=> 400 FROM test_int8_o WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT id FROM test_int8_o WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_int8_o_idx on test_int8_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) +(4 rows) + +SELECT id FROM test_int8_o WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + id +----- + 16 + 39 + 71 + 135 + 168 + 232 + 252 + 354 + 355 + 371 +(10 rows) + +EXPLAIN (costs off) +SELECT id FROM test_int8_o WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_int8_o_idx on test_int8_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint)) +(4 rows) + +SELECT id FROM test_int8_o WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 +(7 rows) + +CREATE TABLE test_int8_a AS SELECT id::int8, t FROM tsts; +CREATE INDEX test_int8_a_idx ON test_int8_a USING rum + (t rum_tsvector_addon_ops, id) + WITH (attach = 'id', to = 't', order_by_attach='t'); +ERROR: doesn't support order index over pass-by-reference column +EXPLAIN (costs off) +SELECT count(*) FROM test_int8_a WHERE id < 400::int8; + QUERY PLAN +-------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on test_int8_a + Disabled Nodes: 1 + Filter: (id < '400'::bigint) +(5 rows) + +SELECT count(*) FROM test_int8_a WHERE id < 400::int8; + count +------- + 401 +(1 row) + +EXPLAIN (costs off) +SELECT id, id <=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + QUERY PLAN +--------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((id <=> '400'::bigint)) + -> Seq Scan on test_int8_a + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, id <=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 371 | 29 + 355 | 45 +(5 rows) + +EXPLAIN (costs off) +SELECT id, id <=| 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + QUERY PLAN +--------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((id <=| '400'::bigint)) + -> Seq Scan on test_int8_a + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, id <=| 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + id | ?column? +-----+---------- + 371 | 29 + 355 | 45 + 354 | 46 + 252 | 148 + 232 | 168 +(5 rows) + +EXPLAIN (costs off) +SELECT id, id |=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + QUERY PLAN +--------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((id |=> '400'::bigint)) + -> Seq Scan on test_int8_a + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, id |=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 457 | 57 + 458 | 58 +(5 rows) + +EXPLAIN (costs off) +SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + QUERY PLAN +------------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_int8_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) +(6 rows) + +SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + id +----- + 16 + 39 + 71 + 135 + 168 + 232 + 252 + 354 + 355 + 371 +(10 rows) + +EXPLAIN (costs off) +SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + QUERY PLAN +------------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_int8_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint)) +(6 rows) + +SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 +(7 rows) + +CREATE TABLE test_int8_h_o AS SELECT id::int8, t FROM tsts; +CREATE INDEX test_int8_h_o_idx ON test_int8_h_o USING rum + (t rum_tsvector_hash_addon_ops, id) + WITH (attach = 'id', to = 't'); +RESET enable_seqscan; +SET enable_indexscan=OFF; +SET enable_indexonlyscan=OFF; +SET enable_bitmapscan=OFF; +SELECT id, id <=> 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 371 | 29 + 355 | 45 +(5 rows) + +SELECT id, id <=| 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + id | ?column? +-----+---------- + 371 | 29 + 355 | 45 + 354 | 46 + 252 | 148 + 232 | 168 +(5 rows) + +SELECT id, id |=> 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 457 | 57 + 458 | 58 +(5 rows) + +SELECT id FROM test_int8_h_o WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + id +----- + 16 + 39 + 71 + 135 + 168 + 232 + 252 + 354 + 355 + 371 +(10 rows) + +SELECT id FROM test_int8_h_o WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 +(7 rows) + +RESET enable_indexscan; +RESET enable_indexonlyscan; +SET enable_seqscan = off; +EXPLAIN (costs off) +SELECT id, id <=> 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + QUERY PLAN +----------------------------------------------------------- + Limit + -> Index Scan using test_int8_h_o_idx on test_int8_h_o + Index Cond: (t @@ '''wr'' & ''qh'''::tsquery) + Order By: (id <=> '400'::bigint) +(4 rows) + +SELECT id, id <=> 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT id, id <=| 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + QUERY PLAN +----------------------------------------------------------- + Limit + -> Index Scan using test_int8_h_o_idx on test_int8_h_o + Index Cond: (t @@ '''wr'' & ''qh'''::tsquery) + Order By: (id <=| '400'::bigint) +(4 rows) + +SELECT id, id <=| 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT id, id |=> 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + QUERY PLAN +----------------------------------------------------------- + Limit + -> Index Scan using test_int8_h_o_idx on test_int8_h_o + Index Cond: (t @@ '''wr'' & ''qh'''::tsquery) + Order By: (id |=> '400'::bigint) +(4 rows) + +SELECT id, id |=> 400 FROM test_int8_h_o WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column +EXPLAIN (costs off) +SELECT id FROM test_int8_h_o WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_int8_h_o_idx on test_int8_h_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) +(4 rows) + +SELECT id FROM test_int8_h_o WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + id +----- + 16 + 39 + 71 + 135 + 168 + 232 + 252 + 354 + 355 + 371 +(10 rows) + +EXPLAIN (costs off) +SELECT id FROM test_int8_h_o WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_int8_h_o_idx on test_int8_h_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint)) +(4 rows) + +SELECT id FROM test_int8_h_o WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 +(7 rows) + +CREATE TABLE test_int8_h_a AS SELECT id::int8, t FROM tsts; +CREATE INDEX test_int8_h_a_idx ON test_int8_h_a USING rum + (t rum_tsvector_hash_addon_ops, id) + WITH (attach = 'id', to = 't', order_by_attach='t'); +ERROR: doesn't support order index over pass-by-reference column +EXPLAIN (costs off) +SELECT count(*) FROM test_int8_h_a WHERE id < 400::int8; + QUERY PLAN +-------------------------------------- + Aggregate + Disabled Nodes: 1 + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: (id < '400'::bigint) +(5 rows) + +SELECT count(*) FROM test_int8_h_a WHERE id < 400::int8; + count +------- + 401 +(1 row) + +EXPLAIN (costs off) +SELECT id, id <=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + QUERY PLAN +--------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((id <=> '400'::bigint)) + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, id <=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 371 | 29 + 355 | 45 +(5 rows) + +EXPLAIN (costs off) +SELECT id, id <=| 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + QUERY PLAN +--------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((id <=| '400'::bigint)) + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, id <=| 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LIMIT 5; + id | ?column? +-----+---------- + 371 | 29 + 355 | 45 + 354 | 46 + 252 | 148 + 232 | 168 +(5 rows) + +EXPLAIN (costs off) +SELECT id, id |=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + QUERY PLAN +--------------------------------------------------------- + Limit + Disabled Nodes: 1 + -> Sort + Disabled Nodes: 1 + Sort Key: ((id |=> '400'::bigint)) + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: (t @@ '''wr'' & ''qh'''::tsquery) +(8 rows) + +SELECT id, id |=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LIMIT 5; + id | ?column? +-----+---------- + 406 | 6 + 415 | 15 + 428 | 28 + 457 | 57 + 458 | 58 +(5 rows) + +EXPLAIN (costs off) +SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + QUERY PLAN +------------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) +(6 rows) + +SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id; + id +----- + 16 + 39 + 71 + 135 + 168 + 232 + 252 + 354 + 355 + 371 +(10 rows) + +EXPLAIN (costs off) +SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + QUERY PLAN +------------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint)) +(6 rows) + +SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 +(7 rows) + +CREATE TABLE test_int8_id_t AS SELECT id::int8, t FROM tsts; +CREATE INDEX test_int8_id_t_idx ON test_int8_o USING rum + (t rum_tsvector_ops, id); +EXPLAIN (costs off) +SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id <=> 400::int8; + QUERY PLAN +------------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: ((id <=> '400'::bigint)) + -> Seq Scan on test_int8_h_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint)) +(6 rows) + +SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id <=> 400::int8; + id +----- + 371 + 355 + 354 + 252 + 232 + 168 + 135 + 71 + 39 + 16 +(10 rows) + diff --git a/expected/orderby.out b/expected/orderby.out index 07ae7322ed..cb3de8aae4 100644 --- a/expected/orderby.out +++ b/expected/orderby.out @@ -192,25 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 (5 rows) -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tsts_idx on tsts - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - id | d | ?column? ------+---------------------------------+------------- - 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 - 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 - 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 - 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 - 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 -(5 rows) - EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN @@ -262,6 +243,26 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER 496 | Sun May 22 11:21:22.326724 2016 (8 rows) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tsts_idx on tsts + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + -- Test index scan RESET enable_indexscan; RESET enable_indexonlyscan; @@ -371,25 +372,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 (5 rows) -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tsts_idx on tsts - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - id | d | ?column? ------+---------------------------------+------------- - 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 - 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 - 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 - 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 - 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 -(5 rows) - EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN @@ -469,6 +451,26 @@ 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) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tsts_idx on tsts + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + -- Test "ORDER BY" error message DROP INDEX tsts_idx; 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 cdd536ac9d..449cae2514 100644 --- a/expected/orderby_1.out +++ b/expected/orderby_1.out @@ -192,17 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 (5 rows) -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tsts_idx on tsts - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -ERROR: doesn't support order by over pass-by-reference column EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN @@ -254,6 +243,18 @@ SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER 496 | Sun May 22 11:21:22.326724 2016 (8 rows) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tsts_idx on tsts + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column -- Test index scan RESET enable_indexscan; RESET enable_indexonlyscan; @@ -340,17 +341,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tsts WHERE t @@ 'wr&qh' ORDER BY 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 EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tsts_idx on tsts - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -ERROR: doesn't support order by over pass-by-reference column -EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- @@ -429,6 +419,18 @@ 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) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tsts_idx on tsts + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column -- Test "ORDER BY" error message DROP INDEX tsts_idx; CREATE INDEX tsts_idx ON tsts USING rum (t rum_tsvector_addon_ops, d); diff --git a/expected/orderby_hash.out b/expected/orderby_hash.out index 782ad5700e..ab94d42395 100644 --- a/expected/orderby_hash.out +++ b/expected/orderby_hash.out @@ -192,25 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 (5 rows) -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tstsh_idx on tstsh - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - id | d | ?column? ------+---------------------------------+------------- - 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 - 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 - 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 - 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 - 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 -(5 rows) - EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN @@ -262,6 +243,26 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER 496 | Sun May 22 11:21:22.326724 2016 (8 rows) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tstsh_idx on tstsh + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + -- Test index scan RESET enable_indexscan; RESET enable_indexonlyscan; @@ -371,25 +372,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 (5 rows) -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tstsh_idx on tstsh - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - id | d | ?column? ------+---------------------------------+------------- - 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 - 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 - 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 - 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 - 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 -(5 rows) - EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN @@ -469,6 +451,26 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER 458 | Fri May 20 21:21:22.326724 2016 (3 rows) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tstsh_idx on tstsh + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + id | d | ?column? +-----+---------------------------------+------------- + 355 | Mon May 16 14:21:22.326724 2016 | 2.673276 + 356 | Mon May 16 15:21:22.326724 2016 | 3597.326724 + 354 | Mon May 16 13:21:22.326724 2016 | 3602.673276 + 357 | Mon May 16 16:21:22.326724 2016 | 7197.326724 + 353 | Mon May 16 12:21:22.326724 2016 | 7202.673276 +(5 rows) + -- Test multicolumn index RESET enable_indexscan; RESET enable_indexonlyscan; diff --git a/expected/orderby_hash_1.out b/expected/orderby_hash_1.out index f19e4507c7..4073025f83 100644 --- a/expected/orderby_hash_1.out +++ b/expected/orderby_hash_1.out @@ -192,17 +192,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY 457 | Fri May 20 20:21:22.326724 2016 | 367197.326724 (5 rows) -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tstsh_idx on tstsh - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -ERROR: doesn't support order by over pass-by-reference column EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN @@ -254,6 +243,18 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER 496 | Sun May 22 11:21:22.326724 2016 (8 rows) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tstsh_idx on tstsh + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +ERROR: doesn't support order by over pass-by-reference column -- Test index scan RESET enable_indexscan; RESET enable_indexonlyscan; @@ -340,17 +341,6 @@ SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh 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 EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - QUERY PLAN ------------------------------------------------------------------------------------ - Limit - -> Index Scan using tstsh_idx on tstsh - Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) -(3 rows) - -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -ERROR: doesn't support order by over pass-by-reference column -EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------- @@ -429,6 +419,18 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER 458 | Fri May 20 21:21:22.326724 2016 (3 rows) +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + QUERY PLAN +----------------------------------------------------------------------------------- + Limit + -> Index Scan using tstsh_idx on tstsh + Order By: (d <=> 'Mon May 16 14:21:25 2016'::timestamp without time zone) +(3 rows) + +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh 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/expected/rum.out b/expected/rum.out index 5966d196fe..d51159b997 100644 --- a/expected/rum.out +++ b/expected/rum.out @@ -163,6 +163,7 @@ SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4), * FROM test_rum + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; distance | rum_ts_distance | t | a ----------+-----------------+---------------------------------------------------------------------+--------------------------------------------------------- diff --git a/expected/rum_hash.out b/expected/rum_hash.out index 43a9760a28..caa6f44185 100644 --- a/expected/rum_hash.out +++ b/expected/rum_hash.out @@ -150,6 +150,7 @@ SELECT rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6), * FROM test_rum_hash + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; distance | rum_ts_distance | rum_ts_score | t | a ----------+-----------------+--------------+---------------------------------------------------------------------+--------------------------------------------------------- diff --git a/expected/text.out b/expected/text.out index 9cf9310a77..36662119ec 100644 --- a/expected/text.out +++ b/expected/text.out @@ -1,3 +1,15 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * text.out - test output for PostgreSQL (<18) + * text_1.out - for PostgreSQL (>=18) + * + */ set enable_seqscan=off; CREATE TABLE test_text ( i text diff --git a/expected/text_1.out b/expected/text_1.out new file mode 100644 index 0000000000..bdf8ea478f --- /dev/null +++ b/expected/text_1.out @@ -0,0 +1,337 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * text.out - test output for PostgreSQL (<18) + * text_1.out - for PostgreSQL (>=18) + * + */ +set enable_seqscan=off; +CREATE TABLE test_text ( + i text +); +INSERT INTO test_text VALUES ('a'),('ab'),('abc'),('abb'),('axy'),('xyz'); +CREATE INDEX idx_text ON test_text USING rum (i); +SELECT * FROM test_text WHERE i<'abc' ORDER BY i; + i +----- + a + ab + abb +(3 rows) + +SELECT * FROM test_text WHERE i<='abc' ORDER BY i; + i +----- + a + ab + abb + abc +(4 rows) + +SELECT * FROM test_text WHERE i='abc' ORDER BY i; + i +----- + abc +(1 row) + +SELECT * FROM test_text WHERE i>='abc' ORDER BY i; + i +----- + abc + axy + xyz +(3 rows) + +SELECT * FROM test_text WHERE i>'abc' ORDER BY i; + i +----- + axy + xyz +(2 rows) + +CREATE TABLE test_text_o AS SELECT id::text, t FROM tsts; +SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + id +----- + 135 + 16 + 168 + 232 + 252 + 354 + 355 + 371 + 39 +(9 rows) + +SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 + 71 +(8 rows) + +CREATE INDEX test_text_o_idx ON test_text_o USING rum + (t rum_tsvector_addon_ops, id) + WITH (attach = 'id', to = 't'); +RESET enable_indexscan; +RESET enable_indexonlyscan; +SET enable_bitmapscan=OFF; +SET enable_seqscan = off; +EXPLAIN (costs off) +SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + QUERY PLAN +--------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_text_o_idx on test_text_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text)) +(4 rows) + +SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + id +----- + 135 + 16 + 168 + 232 + 252 + 354 + 355 + 371 + 39 +(9 rows) + +EXPLAIN (costs off) +SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + QUERY PLAN +--------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_text_o_idx on test_text_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text)) +(4 rows) + +SELECT id FROM test_text_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 + 71 +(8 rows) + +CREATE TABLE test_text_a AS SELECT id::text, t FROM tsts; +-- Should fail, temporarly it isn't allowed to order an index over pass-by-reference column +CREATE INDEX test_text_a_idx ON test_text_a USING rum + (t rum_tsvector_addon_ops, id) + WITH (attach = 'id', to = 't', order_by_attach='t'); +ERROR: doesn't support order index over pass-by-reference column +EXPLAIN (costs off) +SELECT count(*) FROM test_text_a WHERE id < '400'; + QUERY PLAN +------------------------------------ + Aggregate + Disabled Nodes: 1 + -> Seq Scan on test_text_a + Disabled Nodes: 1 + Filter: (id < '400'::text) +(5 rows) + +SELECT count(*) FROM test_text_a WHERE id < '400'; + count +------- + 337 +(1 row) + +EXPLAIN (costs off) +SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_text_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text)) +(6 rows) + +SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + id +----- + 135 + 16 + 168 + 232 + 252 + 354 + 355 + 371 + 39 +(9 rows) + +EXPLAIN (costs off) +SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_text_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text)) +(6 rows) + +SELECT id FROM test_text_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 + 71 +(8 rows) + +CREATE TABLE test_text_h_o AS SELECT id::text, t FROM tsts; +CREATE INDEX test_text_h_o_idx ON test_text_h_o USING rum + (t rum_tsvector_hash_addon_ops, id) + WITH (attach = 'id', to = 't'); +EXPLAIN (costs off) +SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + QUERY PLAN +--------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_text_h_o_idx on test_text_h_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text)) +(4 rows) + +SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + id +----- + 135 + 16 + 168 + 232 + 252 + 354 + 355 + 371 + 39 +(9 rows) + +EXPLAIN (costs off) +SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + QUERY PLAN +--------------------------------------------------------------------------------- + Sort + Sort Key: id + -> Index Scan using test_text_h_o_idx on test_text_h_o + Index Cond: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text)) +(4 rows) + +SELECT id FROM test_text_h_o WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 + 71 +(8 rows) + +CREATE TABLE test_text_h_a AS SELECT id::text, t FROM tsts; +-- Should fail, temporarly it isn't allowed to order an index over pass-by-reference column +CREATE INDEX test_text_h_a_idx ON test_text_h_a USING rum + (t rum_tsvector_hash_addon_ops, id) + WITH (attach = 'id', to = 't', order_by_attach='t'); +ERROR: doesn't support order index over pass-by-reference column +EXPLAIN (costs off) +SELECT count(*) FROM test_text_h_a WHERE id < '400'; + QUERY PLAN +------------------------------------ + Aggregate + Disabled Nodes: 1 + -> Seq Scan on test_text_h_a + Disabled Nodes: 1 + Filter: (id < '400'::text) +(5 rows) + +SELECT count(*) FROM test_text_h_a WHERE id < '400'; + count +------- + 337 +(1 row) + +EXPLAIN (costs off) +SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_text_h_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::text)) +(6 rows) + +SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id <= '400' ORDER BY id; + id +----- + 135 + 16 + 168 + 232 + 252 + 354 + 355 + 371 + 39 +(9 rows) + +EXPLAIN (costs off) +SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + QUERY PLAN +----------------------------------------------------------------------------- + Sort + Disabled Nodes: 1 + Sort Key: id + -> Seq Scan on test_text_h_a + Disabled Nodes: 1 + Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::text)) +(6 rows) + +SELECT id FROM test_text_h_a WHERE t @@ 'wr&qh' AND id >= '400' ORDER BY id; + id +----- + 406 + 415 + 428 + 457 + 458 + 484 + 496 + 71 +(8 rows) + diff --git a/sql/altorder.sql b/sql/altorder.sql index 850e252325..01789d8172 100644 --- a/sql/altorder.sql +++ b/sql/altorder.sql @@ -3,12 +3,15 @@ * NOTE: This test behaves differenly * ------------------------------------ * - * altorder.out - test output for 64-bit systems and - * altorder_1.out - test output for 32-bit systems. + * altorder.out - test output for 64-bit systems + * altorder_1.out - test output for 32-bit systems + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_2.out - test output for 32-bit systems (>=18) * */ - - 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 148407c661..3b9b8121a3 100644 --- a/sql/altorder_hash.sql +++ b/sql/altorder_hash.sql @@ -6,6 +6,11 @@ * altorder_hash.out - test output for 64-bit systems and * altorder_hash_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * altorder_hash_2.out - test output for 32-bit systems (>=18) + * */ diff --git a/sql/array.sql b/sql/array.sql index 9eba800bcf..e9c7adb274 100644 --- a/sql/array.sql +++ b/sql/array.sql @@ -6,6 +6,12 @@ * array.out - test output for 64-bit systems and * array_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * array_2.out - test output for 64-bit systems (>=18). + * array_3.out - test output for 32-bit systems (>=18). + * */ diff --git a/sql/int8.sql b/sql/int8.sql index c51705e62b..a46bb6b7fc 100644 --- a/sql/int8.sql +++ b/sql/int8.sql @@ -6,6 +6,11 @@ * int8.out - test output for 64-bit systems and * int8_1.out - test output for 32-bit systems. * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * int8_2.out - test output for 32-bit systems (>=18) + * */ diff --git a/sql/orderby.sql b/sql/orderby.sql index a2bd227873..f9ccadf123 100644 --- a/sql/orderby.sql +++ b/sql/orderby.sql @@ -54,10 +54,6 @@ EXPLAIN (costs off) 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; 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; -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; @@ -65,6 +61,11 @@ EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + -- Test index scan RESET enable_indexscan; RESET enable_indexonlyscan; @@ -89,10 +90,6 @@ EXPLAIN (costs off) 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; 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; -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - EXPLAIN (costs off) SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; SELECT id, d FROM tsts WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; @@ -106,6 +103,11 @@ 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; +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tsts ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + -- Test "ORDER BY" error message DROP INDEX tsts_idx; diff --git a/sql/orderby_hash.sql b/sql/orderby_hash.sql index dba8f17ca1..3fa4a79962 100644 --- a/sql/orderby_hash.sql +++ b/sql/orderby_hash.sql @@ -54,10 +54,6 @@ EXPLAIN (costs off) SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; @@ -65,6 +61,11 @@ EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d; +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + -- Test index scan RESET enable_indexscan; RESET enable_indexonlyscan; @@ -89,10 +90,6 @@ EXPLAIN (costs off) SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; SELECT id, d, d |=> '2016-05-16 14:21:25' FROM tstsh WHERE t @@ 'wr&qh' ORDER BY d |=> '2016-05-16 14:21:25' LIMIT 5; -EXPLAIN (costs off) -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; -SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; - EXPLAIN (costs off) SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER BY d; @@ -106,6 +103,11 @@ SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d <= '2016-05-16 14:21:25' ORDER SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d ASC LIMIT 3; SELECT id, d FROM tstsh WHERE t @@ 'wr&qh' AND d >= '2016-05-16 14:21:25' ORDER BY d DESC LIMIT 3; +RESET enable_indexscan; +EXPLAIN (costs off) +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; +SELECT id, d, d <=> '2016-05-16 14:21:25' FROM tstsh ORDER BY d <=> '2016-05-16 14:21:25' LIMIT 5; + -- Test multicolumn index RESET enable_indexscan; diff --git a/sql/rum.sql b/sql/rum.sql index 8414bb95c5..dc02b22ddd 100644 --- a/sql/rum.sql +++ b/sql/rum.sql @@ -64,6 +64,7 @@ SELECT rum_ts_distance(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,4), * FROM test_rum + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; -- Check ranking normalization diff --git a/sql/rum_hash.sql b/sql/rum_hash.sql index a33b8fde31..a431e2d130 100644 --- a/sql/rum_hash.sql +++ b/sql/rum_hash.sql @@ -53,6 +53,7 @@ SELECT rum_ts_score(a, to_tsquery('pg_catalog.english', 'way & (go | half)'))::numeric(10,6), * FROM test_rum_hash + WHERE a @@ to_tsquery('pg_catalog.english', 'way & (go | half)') ORDER BY a <=> to_tsquery('pg_catalog.english', 'way & (go | half)') limit 2; -- Check ranking normalization diff --git a/sql/text.sql b/sql/text.sql index 1f340b7109..ab81d9d1fd 100644 --- a/sql/text.sql +++ b/sql/text.sql @@ -1,3 +1,15 @@ +/* + * ------------------------------------ + * NOTE: This test behaves differenly + * ------------------------------------ + * + * Since c01743aa486 (>=18) EXPLAIN output was changed, + * now it includes the number of disabled nodes + * + * text.out - test output for PostgreSQL (<18) + * text_1.out - for PostgreSQL (>=18) + * + */ set enable_seqscan=off; CREATE TABLE test_text ( From 4a1c3005a443f36f4171fa7513d2fc6587fd3122 Mon Sep 17 00:00:00 2001 From: Zharkov Roman Date: Tue, 4 Mar 2025 15:47:51 +0700 Subject: [PATCH 42/47] 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 Date: Fri, 11 Apr 2025 11:54:35 +0300 Subject: [PATCH 43/47] [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 Date: Fri, 18 Apr 2025 17:58:47 +0300 Subject: [PATCH 44/47] 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 From 337b60ed2e3e64ec229641c8d72d55b818c3db31 Mon Sep 17 00:00:00 2001 From: mkharitonov Date: Wed, 23 Apr 2025 10:37:05 +0300 Subject: [PATCH 45/47] [PGPRO-11557] Fix infinite loop with multiple ORDER BY in RUM scan --- src/rumget.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rumget.c b/src/rumget.c index ca5d83ee00..84b3697dc7 100644 --- a/src/rumget.c +++ b/src/rumget.c @@ -1741,7 +1741,11 @@ entryFindItem(RumState * rumstate, RumScanEntry entry, RumItem * item, Snapshot { if (compareRumItemScanDirection(rumstate, entry->attnumOrig, entry->scanDirection, - &entry->curItem, item) >= 0) + &entry->curItem, item) >= 0 && + entry->offset >= 0 && + entry->offset < entry->nlist && + rumCompareItemPointers(&entry->curItem.iptr, + &entry->list[entry->offset].iptr) == 0) return; while (entry->offset >= 0 && entry->offset < entry->nlist) { From 56b2d19a2c6d7a1ce052909e5904bbcf87e24f83 Mon Sep 17 00:00:00 2001 From: Ekaterina Sokolova Date: Tue, 3 Jun 2025 13:40:39 +0300 Subject: [PATCH 46/47] Add clang19 to Travis CI configuration --- travis/Dockerfile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis/Dockerfile.in b/travis/Dockerfile.in index 66625248cc..3101da42a8 100644 --- a/travis/Dockerfile.in +++ b/travis/Dockerfile.in @@ -7,7 +7,7 @@ RUN apk add --no-cache \ perl perl-ipc-run perl-dev perl-app-cpanminus perl-dbi \ make musl-dev gcc bison flex coreutils \ zlib-dev libedit-dev \ - pkgconf icu-dev clang clang15 clang-analyzer; + pkgconf icu-dev clang clang15 clang19 clang-analyzer; # Environment ENV LANG=C.UTF-8 PGDATA=/pg/data From 78c348bc47e15fc8d07a6aea327d13faaf0f680d Mon Sep 17 00:00:00 2001 From: Wenbo Date: Tue, 10 Jun 2025 20:10:23 +0800 Subject: [PATCH 47/47] Fix corruption when entry->buffer changed to nonleaf while unlocked. (#145) The entry->buffer pointer is retrieved, but the underlying buffer can be modified by another thread before it's used, leading to invalid memory access and a segmentation fault. Now we check this case and return from the function. --- src/rumget.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rumget.c b/src/rumget.c index 84b3697dc7..07726d41bf 100644 --- a/src/rumget.c +++ b/src/rumget.c @@ -889,7 +889,14 @@ entryGetNextItem(RumState * rumstate, RumScanEntry entry, Snapshot snapshot) LockBuffer(entry->buffer, RUM_SHARE); page = BufferGetPage(entry->buffer); - + if (!RumPageIsLeaf(page)) + { + /* + * Root page becomes non-leaf while we unlock it. just return. + */ + LockBuffer(entry->buffer, RUM_UNLOCK); + return; + } PredicateLockPage(rumstate->index, BufferGetBlockNumber(entry->buffer), snapshot); if (scanPage(rumstate, entry, &entry->curItem, false))