diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:15:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:15:05 +0000 |
commit | 46651ce6fe013220ed397add242004d764fc0153 (patch) | |
tree | 6e5299f990f88e60174a1d3ae6e48eedd2688b2b /contrib/ltree | |
parent | Initial commit. (diff) | |
download | postgresql-14-upstream.tar.xz postgresql-14-upstream.zip |
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/ltree')
-rw-r--r-- | contrib/ltree/.gitignore | 4 | ||||
-rw-r--r-- | contrib/ltree/Makefile | 34 | ||||
-rw-r--r-- | contrib/ltree/_ltree_gist.c | 555 | ||||
-rw-r--r-- | contrib/ltree/_ltree_op.c | 325 | ||||
-rw-r--r-- | contrib/ltree/crc32.c | 39 | ||||
-rw-r--r-- | contrib/ltree/crc32.h | 12 | ||||
-rw-r--r-- | contrib/ltree/data/_ltree.data | 1000 | ||||
-rw-r--r-- | contrib/ltree/data/ltree.data | 1006 | ||||
-rw-r--r-- | contrib/ltree/expected/ltree.out | 8086 | ||||
-rw-r--r-- | contrib/ltree/lquery_op.c | 281 | ||||
-rw-r--r-- | contrib/ltree/ltree--1.0--1.1.sql | 115 | ||||
-rw-r--r-- | contrib/ltree/ltree--1.1--1.2.sql | 139 | ||||
-rw-r--r-- | contrib/ltree/ltree--1.1.sql | 872 | ||||
-rw-r--r-- | contrib/ltree/ltree.control | 6 | ||||
-rw-r--r-- | contrib/ltree/ltree.h | 303 | ||||
-rw-r--r-- | contrib/ltree/ltree_gist.c | 731 | ||||
-rw-r--r-- | contrib/ltree/ltree_io.c | 797 | ||||
-rw-r--r-- | contrib/ltree/ltree_op.c | 590 | ||||
-rw-r--r-- | contrib/ltree/ltreetest.sql | 21 | ||||
-rw-r--r-- | contrib/ltree/ltxtquery_io.c | 600 | ||||
-rw-r--r-- | contrib/ltree/ltxtquery_op.c | 111 | ||||
-rw-r--r-- | contrib/ltree/sql/ltree.sql | 384 |
22 files changed, 16011 insertions, 0 deletions
diff --git a/contrib/ltree/.gitignore b/contrib/ltree/.gitignore new file mode 100644 index 0000000..5dcb3ff --- /dev/null +++ b/contrib/ltree/.gitignore @@ -0,0 +1,4 @@ +# Generated subdirectories +/log/ +/results/ +/tmp_check/ diff --git a/contrib/ltree/Makefile b/contrib/ltree/Makefile new file mode 100644 index 0000000..b16a566 --- /dev/null +++ b/contrib/ltree/Makefile @@ -0,0 +1,34 @@ +# contrib/ltree/Makefile + +MODULE_big = ltree +OBJS = \ + $(WIN32RES) \ + _ltree_gist.o \ + _ltree_op.o \ + crc32.o \ + lquery_op.o \ + ltree_gist.o \ + ltree_io.o \ + ltree_op.o \ + ltxtquery_io.o \ + ltxtquery_op.o +PG_CPPFLAGS = -DLOWER_NODE + +EXTENSION = ltree +DATA = ltree--1.1--1.2.sql ltree--1.1.sql ltree--1.0--1.1.sql +PGFILEDESC = "ltree - hierarchical label data type" + +HEADERS = ltree.h + +REGRESS = ltree + +ifdef USE_PGXS +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) +else +subdir = contrib/ltree +top_builddir = ../.. +include $(top_builddir)/src/Makefile.global +include $(top_srcdir)/contrib/contrib-global.mk +endif diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c new file mode 100644 index 0000000..72516c3 --- /dev/null +++ b/contrib/ltree/_ltree_gist.c @@ -0,0 +1,555 @@ +/* + * contrib/ltree/_ltree_gist.c + * + * + * GiST support for ltree[] + * Teodor Sigaev <teodor@stack.net> + */ +#include "postgres.h" + +#include "access/gist.h" +#include "access/reloptions.h" +#include "access/stratnum.h" +#include "crc32.h" +#include "ltree.h" +#include "port/pg_bitutils.h" + +PG_FUNCTION_INFO_V1(_ltree_compress); +PG_FUNCTION_INFO_V1(_ltree_same); +PG_FUNCTION_INFO_V1(_ltree_union); +PG_FUNCTION_INFO_V1(_ltree_penalty); +PG_FUNCTION_INFO_V1(_ltree_picksplit); +PG_FUNCTION_INFO_V1(_ltree_consistent); +PG_FUNCTION_INFO_V1(_ltree_gist_options); + +#define GETENTRY(vec,pos) ((ltree_gist *) DatumGetPointer((vec)->vector[(pos)].key)) +#define NEXTVAL(x) ( (ltree*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) ) + +#define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) ) + + +static void +hashing(BITVECP sign, ltree *t, int siglen) +{ + int tlen = t->numlevel; + ltree_level *cur = LTREE_FIRST(t); + int hash; + + while (tlen > 0) + { + hash = ltree_crc32_sz(cur->name, cur->len); + AHASH(sign, hash, siglen); + cur = LEVEL_NEXT(cur); + tlen--; + } +} + +Datum +_ltree_compress(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + GISTENTRY *retval = entry; + int siglen = LTREE_GET_ASIGLEN(); + + if (entry->leafkey) + { /* ltree */ + ltree_gist *key; + ArrayType *val = DatumGetArrayTypeP(entry->key); + int num = ArrayGetNItems(ARR_NDIM(val), ARR_DIMS(val)); + ltree *item = (ltree *) ARR_DATA_PTR(val); + + if (ARR_NDIM(val) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(val)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + key = ltree_gist_alloc(false, NULL, siglen, NULL, NULL); + + while (num > 0) + { + hashing(LTG_SIGN(key), item, siglen); + num--; + item = NEXTVAL(item); + } + + retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); + gistentryinit(*retval, PointerGetDatum(key), + entry->rel, entry->page, + entry->offset, false); + } + else if (!LTG_ISALLTRUE(entry->key)) + { + int32 i; + ltree_gist *key; + BITVECP sign = LTG_SIGN(DatumGetPointer(entry->key)); + + ALOOPBYTE(siglen) + { + if ((sign[i] & 0xff) != 0xff) + PG_RETURN_POINTER(retval); + } + + key = ltree_gist_alloc(true, sign, siglen, NULL, NULL); + retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); + gistentryinit(*retval, PointerGetDatum(key), + entry->rel, entry->page, + entry->offset, false); + } + PG_RETURN_POINTER(retval); +} + +Datum +_ltree_same(PG_FUNCTION_ARGS) +{ + ltree_gist *a = (ltree_gist *) PG_GETARG_POINTER(0); + ltree_gist *b = (ltree_gist *) PG_GETARG_POINTER(1); + bool *result = (bool *) PG_GETARG_POINTER(2); + int siglen = LTREE_GET_ASIGLEN(); + + if (LTG_ISALLTRUE(a) && LTG_ISALLTRUE(b)) + *result = true; + else if (LTG_ISALLTRUE(a)) + *result = false; + else if (LTG_ISALLTRUE(b)) + *result = false; + else + { + int32 i; + BITVECP sa = LTG_SIGN(a), + sb = LTG_SIGN(b); + + *result = true; + ALOOPBYTE(siglen) + { + if (sa[i] != sb[i]) + { + *result = false; + break; + } + } + } + PG_RETURN_POINTER(result); +} + +static int32 +unionkey(BITVECP sbase, ltree_gist *add, int siglen) +{ + int32 i; + BITVECP sadd = LTG_SIGN(add); + + if (LTG_ISALLTRUE(add)) + return 1; + + ALOOPBYTE(siglen) + sbase[i] |= sadd[i]; + return 0; +} + +Datum +_ltree_union(PG_FUNCTION_ARGS) +{ + GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0); + int *size = (int *) PG_GETARG_POINTER(1); + int siglen = LTREE_GET_ASIGLEN(); + int32 i; + ltree_gist *result = ltree_gist_alloc(false, NULL, siglen, NULL, NULL); + BITVECP base = LTG_SIGN(result); + + for (i = 0; i < entryvec->n; i++) + { + if (unionkey(base, GETENTRY(entryvec, i), siglen)) + { + result->flag |= LTG_ALLTRUE; + SET_VARSIZE(result, LTG_HDRSIZE); + break; + } + } + + *size = VARSIZE(result); + + PG_RETURN_POINTER(result); +} + +static int32 +sizebitvec(BITVECP sign, int siglen) +{ + return pg_popcount((const char *) sign, siglen); +} + +static int +hemdistsign(BITVECP a, BITVECP b, int siglen) +{ + int i, + diff, + dist = 0; + + ALOOPBYTE(siglen) + { + diff = (unsigned char) (a[i] ^ b[i]); + /* Using the popcount functions here isn't likely to win */ + dist += pg_number_of_ones[diff]; + } + return dist; +} + +static int +hemdist(ltree_gist *a, ltree_gist *b, int siglen) +{ + if (LTG_ISALLTRUE(a)) + { + if (LTG_ISALLTRUE(b)) + return 0; + else + return ASIGLENBIT(siglen) - sizebitvec(LTG_SIGN(b), siglen); + } + else if (LTG_ISALLTRUE(b)) + return ASIGLENBIT(siglen) - sizebitvec(LTG_SIGN(a), siglen); + + return hemdistsign(LTG_SIGN(a), LTG_SIGN(b), siglen); +} + + +Datum +_ltree_penalty(PG_FUNCTION_ARGS) +{ + ltree_gist *origval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key); + ltree_gist *newval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key); + float *penalty = (float *) PG_GETARG_POINTER(2); + int siglen = LTREE_GET_ASIGLEN(); + + *penalty = hemdist(origval, newval, siglen); + PG_RETURN_POINTER(penalty); +} + +typedef struct +{ + OffsetNumber pos; + int32 cost; +} SPLITCOST; + +static int +comparecost(const void *a, const void *b) +{ + return ((const SPLITCOST *) a)->cost - ((const SPLITCOST *) b)->cost; +} + +Datum +_ltree_picksplit(PG_FUNCTION_ARGS) +{ + GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0); + GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1); + int siglen = LTREE_GET_ASIGLEN(); + OffsetNumber k, + j; + ltree_gist *datum_l, + *datum_r; + BITVECP union_l, + union_r; + int32 size_alpha, + size_beta; + int32 size_waste, + waste = -1; + int32 nbytes; + OffsetNumber seed_1 = 0, + seed_2 = 0; + OffsetNumber *left, + *right; + OffsetNumber maxoff; + BITVECP ptr; + int i; + SPLITCOST *costvector; + ltree_gist *_k, + *_j; + + maxoff = entryvec->n - 2; + nbytes = (maxoff + 2) * sizeof(OffsetNumber); + v->spl_left = (OffsetNumber *) palloc(nbytes); + v->spl_right = (OffsetNumber *) palloc(nbytes); + + for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k)) + { + _k = GETENTRY(entryvec, k); + for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j)) + { + size_waste = hemdist(_k, GETENTRY(entryvec, j), siglen); + if (size_waste > waste) + { + waste = size_waste; + seed_1 = k; + seed_2 = j; + } + } + } + + left = v->spl_left; + v->spl_nleft = 0; + right = v->spl_right; + v->spl_nright = 0; + + if (seed_1 == 0 || seed_2 == 0) + { + seed_1 = 1; + seed_2 = 2; + } + + /* form initial .. */ + datum_l = ltree_gist_alloc(LTG_ISALLTRUE(GETENTRY(entryvec, seed_1)), + LTG_SIGN(GETENTRY(entryvec, seed_1)), + siglen, NULL, NULL); + + datum_r = ltree_gist_alloc(LTG_ISALLTRUE(GETENTRY(entryvec, seed_2)), + LTG_SIGN(GETENTRY(entryvec, seed_2)), + siglen, NULL, NULL); + + maxoff = OffsetNumberNext(maxoff); + /* sort before ... */ + costvector = (SPLITCOST *) palloc(sizeof(SPLITCOST) * maxoff); + for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) + { + costvector[j - 1].pos = j; + _j = GETENTRY(entryvec, j); + size_alpha = hemdist(datum_l, _j, siglen); + size_beta = hemdist(datum_r, _j, siglen); + costvector[j - 1].cost = Abs(size_alpha - size_beta); + } + qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost); + + union_l = LTG_SIGN(datum_l); + union_r = LTG_SIGN(datum_r); + + for (k = 0; k < maxoff; k++) + { + j = costvector[k].pos; + if (j == seed_1) + { + *left++ = j; + v->spl_nleft++; + continue; + } + else if (j == seed_2) + { + *right++ = j; + v->spl_nright++; + continue; + } + _j = GETENTRY(entryvec, j); + size_alpha = hemdist(datum_l, _j, siglen); + size_beta = hemdist(datum_r, _j, siglen); + + if (size_alpha < size_beta + WISH_F(v->spl_nleft, v->spl_nright, 0.00001)) + { + if (LTG_ISALLTRUE(datum_l) || LTG_ISALLTRUE(_j)) + { + if (!LTG_ISALLTRUE(datum_l)) + MemSet((void *) union_l, 0xff, siglen); + } + else + { + ptr = LTG_SIGN(_j); + ALOOPBYTE(siglen) + union_l[i] |= ptr[i]; + } + *left++ = j; + v->spl_nleft++; + } + else + { + if (LTG_ISALLTRUE(datum_r) || LTG_ISALLTRUE(_j)) + { + if (!LTG_ISALLTRUE(datum_r)) + MemSet((void *) union_r, 0xff, siglen); + } + else + { + ptr = LTG_SIGN(_j); + ALOOPBYTE(siglen) + union_r[i] |= ptr[i]; + } + *right++ = j; + v->spl_nright++; + } + } + + *right = *left = FirstOffsetNumber; + + v->spl_ldatum = PointerGetDatum(datum_l); + v->spl_rdatum = PointerGetDatum(datum_r); + + PG_RETURN_POINTER(v); +} + +static bool +gist_te(ltree_gist *key, ltree *query, int siglen) +{ + ltree_level *curq = LTREE_FIRST(query); + BITVECP sign = LTG_SIGN(key); + int qlen = query->numlevel; + unsigned int hv; + + if (LTG_ISALLTRUE(key)) + return true; + + while (qlen > 0) + { + hv = ltree_crc32_sz(curq->name, curq->len); + if (!GETBIT(sign, AHASHVAL(hv, siglen))) + return false; + curq = LEVEL_NEXT(curq); + qlen--; + } + + return true; +} + +typedef struct LtreeSignature +{ + BITVECP sign; + int siglen; +} LtreeSignature; + +static bool +checkcondition_bit(void *cxt, ITEM *val) +{ + LtreeSignature *sig = cxt; + + return (FLG_CANLOOKSIGN(val->flag)) ? GETBIT(sig->sign, AHASHVAL(val->val, sig->siglen)) : true; +} + +static bool +gist_qtxt(ltree_gist *key, ltxtquery *query, int siglen) +{ + LtreeSignature sig; + + if (LTG_ISALLTRUE(key)) + return true; + + sig.sign = LTG_SIGN(key); + sig.siglen = siglen; + + return ltree_execute(GETQUERY(query), + &sig, false, + checkcondition_bit); +} + +static bool +gist_qe(ltree_gist *key, lquery *query, int siglen) +{ + lquery_level *curq = LQUERY_FIRST(query); + BITVECP sign = LTG_SIGN(key); + int qlen = query->numlevel; + + if (LTG_ISALLTRUE(key)) + return true; + + while (qlen > 0) + { + if (curq->numvar && LQL_CANLOOKSIGN(curq)) + { + bool isexist = false; + int vlen = curq->numvar; + lquery_variant *curv = LQL_FIRST(curq); + + while (vlen > 0) + { + if (GETBIT(sign, AHASHVAL(curv->val, siglen))) + { + isexist = true; + break; + } + curv = LVAR_NEXT(curv); + vlen--; + } + if (!isexist) + return false; + } + + curq = LQL_NEXT(curq); + qlen--; + } + + return true; +} + +static bool +_arrq_cons(ltree_gist *key, ArrayType *_query, int siglen) +{ + lquery *query = (lquery *) ARR_DATA_PTR(_query); + int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query)); + + if (ARR_NDIM(_query) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + while (num > 0) + { + if (gist_qe(key, query, siglen)) + return true; + num--; + query = (lquery *) NEXTVAL(query); + } + return false; +} + +Datum +_ltree_consistent(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + void *query = (void *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1)); + StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); + int siglen = LTREE_GET_ASIGLEN(); + ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key); + bool res = false; + + /* All cases served by this function are inexact */ + *recheck = true; + + switch (strategy) + { + case 10: + case 11: + res = gist_te(key, (ltree *) query, siglen); + break; + case 12: + case 13: + res = gist_qe(key, (lquery *) query, siglen); + break; + case 14: + case 15: + res = gist_qtxt(key, (ltxtquery *) query, siglen); + break; + case 16: + case 17: + res = _arrq_cons(key, (ArrayType *) query, siglen); + break; + default: + /* internal error */ + elog(ERROR, "unrecognized StrategyNumber: %d", strategy); + } + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +_ltree_gist_options(PG_FUNCTION_ARGS) +{ + local_relopts *relopts = (local_relopts *) PG_GETARG_POINTER(0); + + init_local_reloptions(relopts, sizeof(LtreeGistOptions)); + add_local_int_reloption(relopts, "siglen", "signature length", + LTREE_ASIGLEN_DEFAULT, 1, LTREE_ASIGLEN_MAX, + offsetof(LtreeGistOptions, siglen)); + + PG_RETURN_VOID(); +} diff --git a/contrib/ltree/_ltree_op.c b/contrib/ltree/_ltree_op.c new file mode 100644 index 0000000..9bb6bca --- /dev/null +++ b/contrib/ltree/_ltree_op.c @@ -0,0 +1,325 @@ +/* + * contrib/ltree/_ltree_op.c + * + * + * op function for ltree[] + * Teodor Sigaev <teodor@stack.net> + */ +#include "postgres.h" + +#include <ctype.h> + +#include "ltree.h" + +PG_FUNCTION_INFO_V1(_ltree_isparent); +PG_FUNCTION_INFO_V1(_ltree_r_isparent); +PG_FUNCTION_INFO_V1(_ltree_risparent); +PG_FUNCTION_INFO_V1(_ltree_r_risparent); +PG_FUNCTION_INFO_V1(_ltq_regex); +PG_FUNCTION_INFO_V1(_ltq_rregex); +PG_FUNCTION_INFO_V1(_lt_q_regex); +PG_FUNCTION_INFO_V1(_lt_q_rregex); +PG_FUNCTION_INFO_V1(_ltxtq_exec); +PG_FUNCTION_INFO_V1(_ltxtq_rexec); + +PG_FUNCTION_INFO_V1(_ltree_extract_isparent); +PG_FUNCTION_INFO_V1(_ltree_extract_risparent); +PG_FUNCTION_INFO_V1(_ltq_extract_regex); +PG_FUNCTION_INFO_V1(_ltxtq_extract_exec); + +PG_FUNCTION_INFO_V1(_lca); + +typedef Datum (*PGCALL2) (PG_FUNCTION_ARGS); + +#define NEXTVAL(x) ( (ltree*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) ) + +static bool +array_iterator(ArrayType *la, PGCALL2 callback, void *param, ltree **found) +{ + int num = ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la)); + ltree *item = (ltree *) ARR_DATA_PTR(la); + + if (ARR_NDIM(la) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(la)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + if (found) + *found = NULL; + while (num > 0) + { + if (DatumGetBool(DirectFunctionCall2(callback, + PointerGetDatum(item), PointerGetDatum(param)))) + { + + if (found) + *found = item; + return true; + } + num--; + item = NEXTVAL(item); + } + + return false; +} + +Datum +_ltree_isparent(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + ltree *query = PG_GETARG_LTREE_P(1); + bool res = array_iterator(la, ltree_isparent, (void *) query, NULL); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +_ltree_r_isparent(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(_ltree_isparent, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} + +Datum +_ltree_risparent(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + ltree *query = PG_GETARG_LTREE_P(1); + bool res = array_iterator(la, ltree_risparent, (void *) query, NULL); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +_ltree_r_risparent(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(_ltree_risparent, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} + +Datum +_ltq_regex(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + lquery *query = PG_GETARG_LQUERY_P(1); + bool res = array_iterator(la, ltq_regex, (void *) query, NULL); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +_ltq_rregex(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(_ltq_regex, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} + +Datum +_lt_q_regex(PG_FUNCTION_ARGS) +{ + ArrayType *_tree = PG_GETARG_ARRAYTYPE_P(0); + ArrayType *_query = PG_GETARG_ARRAYTYPE_P(1); + lquery *query = (lquery *) ARR_DATA_PTR(_query); + bool res = false; + int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query)); + + if (ARR_NDIM(_query) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + while (num > 0) + { + if (array_iterator(_tree, ltq_regex, (void *) query, NULL)) + { + res = true; + break; + } + num--; + query = (lquery *) NEXTVAL(query); + } + + PG_FREE_IF_COPY(_tree, 0); + PG_FREE_IF_COPY(_query, 1); + PG_RETURN_BOOL(res); +} + +Datum +_lt_q_rregex(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(_lt_q_regex, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} + + +Datum +_ltxtq_exec(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + ltxtquery *query = PG_GETARG_LTXTQUERY_P(1); + bool res = array_iterator(la, ltxtq_exec, (void *) query, NULL); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +_ltxtq_rexec(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(_ltxtq_exec, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} + + +Datum +_ltree_extract_isparent(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + ltree *query = PG_GETARG_LTREE_P(1); + ltree *found, + *item; + + if (!array_iterator(la, ltree_isparent, (void *) query, &found)) + { + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_NULL(); + } + + item = (ltree *) palloc0(VARSIZE(found)); + memcpy(item, found, VARSIZE(found)); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_POINTER(item); +} + +Datum +_ltree_extract_risparent(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + ltree *query = PG_GETARG_LTREE_P(1); + ltree *found, + *item; + + if (!array_iterator(la, ltree_risparent, (void *) query, &found)) + { + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_NULL(); + } + + item = (ltree *) palloc0(VARSIZE(found)); + memcpy(item, found, VARSIZE(found)); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_POINTER(item); +} + +Datum +_ltq_extract_regex(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + lquery *query = PG_GETARG_LQUERY_P(1); + ltree *found, + *item; + + if (!array_iterator(la, ltq_regex, (void *) query, &found)) + { + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_NULL(); + } + + item = (ltree *) palloc0(VARSIZE(found)); + memcpy(item, found, VARSIZE(found)); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_POINTER(item); +} + +Datum +_ltxtq_extract_exec(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + ltxtquery *query = PG_GETARG_LTXTQUERY_P(1); + ltree *found, + *item; + + if (!array_iterator(la, ltxtq_exec, (void *) query, &found)) + { + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_NULL(); + } + + item = (ltree *) palloc0(VARSIZE(found)); + memcpy(item, found, VARSIZE(found)); + + PG_FREE_IF_COPY(la, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_POINTER(item); +} + +Datum +_lca(PG_FUNCTION_ARGS) +{ + ArrayType *la = PG_GETARG_ARRAYTYPE_P(0); + int num = ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la)); + ltree *item = (ltree *) ARR_DATA_PTR(la); + ltree **a, + *res; + + if (ARR_NDIM(la) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(la)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + a = (ltree **) palloc(sizeof(ltree *) * num); + while (num > 0) + { + num--; + a[num] = item; + item = NEXTVAL(item); + } + res = lca_inner(a, ArrayGetNItems(ARR_NDIM(la), ARR_DIMS(la))); + pfree(a); + + PG_FREE_IF_COPY(la, 0); + + if (res) + PG_RETURN_POINTER(res); + else + PG_RETURN_NULL(); +} diff --git a/contrib/ltree/crc32.c b/contrib/ltree/crc32.c new file mode 100644 index 0000000..8fed334 --- /dev/null +++ b/contrib/ltree/crc32.c @@ -0,0 +1,39 @@ +/* contrib/ltree/crc32.c */ + +/* + * Implements CRC-32, as used in ltree. + * + * Note that the CRC is used in the on-disk format of GiST indexes, so we + * must stay backwards-compatible! + */ + +#include "postgres.h" + +#ifdef LOWER_NODE +#include <ctype.h> +#define TOLOWER(x) tolower((unsigned char) (x)) +#else +#define TOLOWER(x) (x) +#endif + +#include "crc32.h" +#include "utils/pg_crc.h" + +unsigned int +ltree_crc32_sz(const char *buf, int size) +{ + pg_crc32 crc; + const char *p = buf; + + INIT_TRADITIONAL_CRC32(crc); + while (size > 0) + { + char c = (char) TOLOWER(*p); + + COMP_TRADITIONAL_CRC32(crc, &c, 1); + size--; + p++; + } + FIN_TRADITIONAL_CRC32(crc); + return (unsigned int) crc; +} diff --git a/contrib/ltree/crc32.h b/contrib/ltree/crc32.h new file mode 100644 index 0000000..9588122 --- /dev/null +++ b/contrib/ltree/crc32.h @@ -0,0 +1,12 @@ +#ifndef _CRC32_H +#define _CRC32_H + +/* contrib/ltree/crc32.h */ + +/* Returns crc32 of data block */ +extern unsigned int ltree_crc32_sz(const char *buf, int size); + +/* Returns crc32 of null-terminated string */ +#define crc32(buf) ltree_crc32_sz((buf),strlen(buf)) + +#endif diff --git a/contrib/ltree/data/_ltree.data b/contrib/ltree/data/_ltree.data new file mode 100644 index 0000000..9ba2787 --- /dev/null +++ b/contrib/ltree/data/_ltree.data @@ -0,0 +1,1000 @@ +{14.30.13.5.26.9.22.23.14.10, 22.8.20.1.10.28.6.27, 16.30.10.7.29.4.9.21.22.13.26} +{5.8.17.30.15.8.19.29.30.11.6, 3.13, 15.8.10, 23.17.28.31.28} +{22.23.22.30, 4.31, 7.13, 32.6.31.31} +{19.10.26.19.5.21.30.23, 24.1.10.20.28.18.6.27.20.30.26, 5.4.8.25.12.27.2.29.28.3, 1.1.1.2} +{11.14.21.24.10.7.29.23.24.28, 31.13.9.1.5.12, 23.12.32.22.19.1.22.4} +{8.32.30.1, 13.8.20.9.21, 8.29.6.3, 30.8.9.14.25.30, 24.2.26.24.14.15.31.23.17.26} +{28.5.12.9.2.27.11.11.2, 24.9.27.16.20.21, 31.30.12.20} +{29.9.25.27.15.16.32.26.6.32, 5.24.25.15.27.30.20} +{12.21.20.20, 4.14.10.19.16, 2.15.14.20.30.26, 19.26.24.27.6.24.16.27.32.29, 29.10.12.17.12.16} +{22.23.22.30, 25.19.27.2.9.20} +{5.3.29.9.22, 28.14.32.29.2.3.4, 21.14.25.20.13.31.14.20, 22.25.4.28.9.20.12.13} +{19.16.31.31.29.12, 1.30.18.31.12.25.4.19.28.12.15, 25.24.29} +{27.27.25.10.31.10.21.22.21.16.12, 7.30.5.10.10.5.30.14.9.18, 3.6.24.21.20.32.3.4.26.5} +{24.9.27.16.20.21, 12.11.20.20.29, 12.29.17.2.20.29.1.11.19.8.12} +{25.2.11.20.8.6.22, 22.24.22.25.15.23.13} +{16.14.3.17.17.26.12.19.19.30, 28.20.8.9.9.28.30.29, 14.9.15.21.21.31.1.29} +{6.26.29.10.21.28.20.19, 23.24.11.31.10.31.18.28.13.18.6, 13.17.7, 29.23.1.21.31.8, 7.27.20} +{22.17.4.2.22.17, 19.9.32.23.13.24.1} +{26.31.7, 16.21.13.1.4} +{22.23.25.28.5.27.9.9.24.31.10, 18.9.26.7, 23.14.12.30.18.4.16.18.7.7, 27.29.1.5.30.6.22.16.23.2.28, 10.29} +{30.27.8.6.11.19, 3.15.2.23.22.2.16.14} +{25.17.18.30, 18.29.5.1.10.21.2, 8.21.17.3.6.3.18, 26.31.7, 26.11} +{5.27.32.21.5.1.11.14, 27.3.3.11.21.4.25, 4.2.16.13.16.11.19.10.10.25, 32.3.23.7.2} +{3.21.6.13.12.18.25, 1.27.22.23.2.26.32.17.7.9, 9.23.21.22.5.29.15.21, 15.5.1.31.28.10.8, 27.5.15.1.15.16.21} +{30.25.17.17.10.29, 31.29.18.26.1.26.17, 2.2.18.18.3.3.18.8.10.8, 8.31.22.27, 18.9.21.2.31.8.32} +{14.6.10.29.25.26.20.24.24, 24.25.7.27.30.8.26.17, 3.4.22.19, 31.29.4.29.24.30.30.32.10.23, 14.5.13.19.25.12.32.9.13.16.12} +{8.10, 20.6.3.26.7.29.28.4, 31.29.4.29.24.30.30.32.10.23, 30.18.30.16.29} +{14.21.6.5.26.9.32.16.25, 29.20.1.11.21.16.1.2.14.28} +{12.7.16.8.21.22.2.16.18, 6.7.25.16.13.21.7.20.25.12.4, 18.29.13.24.18.3.12.18.12.12, 26.7.5.8.11.9.22.1.6, 32.30.18.17.1.14.12.18} +{21.15.18.18.30.3.20, 22.10.16.8, 26.18.32.20} +{5.27.28.26.14.15.6.20.1.31.13, 30.23.10.1.10.7.22.28.18.11.17, 5.27.28.26.14.15.6.20.1.31.13} +{9.6.9.21.6.11.29.13.29.20.32, 27.21.28.24.7.2.24.23.8, 26.25.10.10.13, 14.17.7.30.8.25.26.4} +{10.3.19, 10.16.19.7.15, 1.1, 14.21.6.5.26.9.32.16.25, 24.3.23.25} +{15.10.30.1.4.12.8.20, 22.25.4.28.9.20.12.13} +{15.9.8.20.27, 8.13.9.31.20.20.24.7.23.31.28, 15.1.8, 28.25.29.4.13.5.6} +{24.24, 20.3.1.8.8.30.20, 6.19.6.4.9.11.32.17.17.3.15, 9.31.4.14.31.10.17.5.2} +{21.9.32.1.27, 29.14.31.25.7.32.23, 25.16.9.6} +{1, 16.13.2.19.14.29.31.30.23.15.12, 26.19.3.14.8.28.31.10, 31.5.6.4.8.29.3, 1.11.10.19.6.1.26.17.2.22} +{29.3.15.17.12.29, 19.9.32.23.13.24.1, 2.32.8.28.24.20.9.24.25.8.9, 30.12.9.25.24.6.7.24.29} +{9.22.10.15.5.15, 29.30.7.31.22} +{16.8.29.7.21.2.3, 23.10.5.26.12.4.20.4, 1.12.25.26.22.8.15.23, 4.9, 14.1.15.25.27.23.25.26.28.10} +{11.17.10, 10.22.30.16.2.21.17.13, 29.27.7.7.3.11.14.26.21.11} +{11.14.21.24.10.7.29.23.24.28, 27.22.11.13.21.25.5.1.27.21.27} +{5.2.32.19.13.29.12.13.31.29, 8.6.6.5.8.8.12, 23.20.8, 5.27.21.1.29.29.28} +{13.30.24, 17.11.17.4.8.26.26.20.6, 12.1.28.22.25} +{5.14.27.15.11.17.3.10.27.25, 20.23.29.5.7.30.13.14.22, 24.13.1.8, 27.26.29, 27.18.10.4.22} +{19.16.26.2, 25.3, 10.5.5.15.29.2} +{32.6.3.2.12.5.28.1.25, 5.18.9.25.31.21.22} +{13.8.20.9.21, 24.9.15.1.14.29.6.4} +{1.15.17.6.28.25.24.31.27.9, 2.1.12.19.29.28.3.31.28.28.10, 25.16.9.6, 32.4.19} +{30.12.6.30, 30.31.13.9, 23.12.19.25.16.23.22.6.29.4, 21.18.30.19.24.24} +{26.26.22.21.14.11.29.19.14.24, 7.31.4.20.17, 14.30.13.5.26.9.22.23.14.10, 8.1.29.18.22} +{12.23.3.19.29.15.12.6, 2.4.25.32.16.22.26.13.17.18, 32.6.13.8.32, 31.18.32.11.7.25.20.5, 10.31} +{7.23.15.32.28.27.2.2.26, 8.32.30.1, 31.28.32.4.31.4.7, 2.31.25, 11.2.27.3} +{11.12.6.21, 22.28.20.6.32.32} +{21.14.22.29, 20.30.28.15.17, 4.22.17.10.19.9.8.19.28.3.9} +{31.18.25.1.14.29.25.5.22.30, 24.32.27, 8.21.8.23.4.18} +{28.15.25.7.13.6.19.2, 32.8.5, 25.17.18.17.27} +{6.25.17.32, 22.17.7.30.13.24, 3.9.25.26.7, 14.23.31.5.5.15.17.12.17.7.3, 18.15.14} +{13.12, 16.5.14.21.32.17.23.3.4.26} +{1.19.22.11.14.7.32.23.19.14, 12.1.1, 19.26.24.27.6.24.16.27.32.29, 24.15.15.17.22} +{10.27.7.24.26.11.31.20.29, 3.15.2.23.22.2.16.14, 26.32.8.12.30.19.24.8.6.1.10, 10.3.19} +{28.26.25.7, 13.28.14.2.8.18, 7.31.2.28.15.11.17.18.19.23.6} +{25.24.29, 21.18.2.1, 13.3.20} +{32.25.16, 22.19.5.22.20.31.23.24.14.24.4, 5.27.16.3.30, 12.25.32.2.27.3.3.16, 30.25.8.24.6.29.31} +{30.24.23.25.32.18.22.12.29.9.22, 11.30} +{9.22.10.15.5.15, 25.16.9.6, 23.10.13.32.14.20.16.11.14} +{22.10.27.19.29.20.29.3.12.14.25, 26.32.21.31.27.12, 3.26.32, 17.26.18} +{5.14.29.2.23.16.20.22, 11.6.11.29.4.5.24.6.26.12, 8.21.17.3.6.3.18, 26.26.22.21.14.11.29.19.14.24} +{28.8.21.15.16.28.4.16.26.8, 19.6.13.14.22.13.9.29, 11.17.10} +{25.28.30.24, 26.25.24, 25.10.29.3.6.21.3.31.13} +{32.24.29.6, 10.18.12.27.24.30.32.7.11.5.13, 20.6.26.3.30} +{19.26.24.27.6.24.16.27.32.29, 1.31.3} +{19.10.4.30.32.4.12, 20.25.22.19.22, 17.13.14.29.27.27.13.12.15, 5.1.5.31, 4.15.20.23.12.16.2.16.17} +{16.13.19.11.18.13.17.17, 17.25.26.23.32, 31.18.27.15.20.29.29} +{24.15.15.17.22, 24.2.26.24.14.15.31.23.17.26, 12.22.20.4.12, 3.13, 25.32.24.24.28.15.16.10} +{4.11.19.17.2.22.20.18.13.32.15, 14.1.11, 14.8.15.30.7.29.27.31.4} +{3.29.19.2.24, 24.23.29.8.24.11.21.10.28.14.27, 32.31.11.22.1, 31.13, 12.21.20.20} +{28.4, 14.30.13.5.26.9.22.23.14.10, 19.26.32.13.1.12.30.26.22.25} +{4.26.2.2, 9.30, 18.13.6.12.26.26.26.29.18.20.1, 22.23.22.30} +{26.11, 7.19.10.12.31.1.27.13.19, 15.17} +{12.16.13, 14.30.13.5.26.9.22.23.14.10, 21.5.17.19.15.25.18.21.24.9, 18.9.26.7} +{30.27.8.6.11.19, 22.18.20.23.15.9.12} +{31.18.32.11.7.25.20.5, 3.15.2.23.22.2.16.14} +{22.20.30, 23.28.3.30.15.31.32.3.21.9.19, 6.18.1.4.18.23, 1.30.18.31.12.25.4.19.28.12.15, 17.13.19.31.12.18.10.15.14} +{32.2.11, 22.24.22.25.15.23.13, 25.10.29.3.6.21.3.31.13, 20.32.9} +{16.8.29.7.21.2.3, 6.27.29.14.8.12.26.3.21.4.1, 21.14.22.29} +{15.8.10, 23.22.10.1.14.24, 23.5.7.12.11.23.10} +{6.29.32.13.30.3.16, 24.23.29.8.24.11.21.10.28.14.27} +{18.17.6.16.6.10, 14.19.30.6.4.10.10.10.22.25.11} +{14.17.7.30.8.25.26.4, 16.13.19.11.18.13.17.17} +{2.4.25.32.16.22.26.13.17.18, 7.16.20.17, 22.30} +{9.2.4.27.26, 15.3.31.9.27.14.9.8.14.6.32, 10.5.5.15.29.2, 16.14.3.17.17.26.12.19.19.30} +{16.9.32.14.3.7.8.7.21.22, 4.13, 31.18.27.15.20.29.29, 13.14.13.10.28.26.9.18.27.21} +{2.28.5.17.6.32, 18.27.11.27.9.16.7.6.22.26.27, 29.5.18.27.3.21.18.6.14} +{25.14.5.32.25, 30.24.32.15.14.10.11} +{27.2.10.4.25.14.2.15.4, 1.22.19.24.8.11, 4.1.24.24.28.24.18} +{5.15.16, 22.18.20.23.15.9.12, 8.11.20, 12.16.2.4.15, 21.17.27.23.15} +{8.9.25.25.26.30.31.31.2.32.7, 1.1, 23.28.20.25.30.24.15, 26.5.29.7.28, 25.17.18.30} +{32.6.8, 22.13.22.21.25.17.8, 6.29.32.13.30.3.16, 2.2.18.18.3.3.18.8.10.8, 6.7.7} +{8.13.14.11.11.29.22.4.4.10, 26.28.14, 32.24.29.6, 25.10, 15.26.24.31.16.15.17.22.8.30.3} +{14.16.6.29.26.13.14.16.25.26.8, 4.16.7.25.21.7, 13.32.15.32.26.14.32} +{25.9.1.5.9.11.25.4.11.27.32, 25.17.2.20.20.3.29.21.3.12, 8.32.30.1} +{19.15.26.19, 6.7.25.16.13.21.7.20.25.12.4, 7.5.28.8.17.26.31.10.15} +{6.19.3, 17.25.10.13.21.5.7.22.2, 11.11.9.30.15.29.15.18, 21.18, 18.9.21.2.31.8.32} +{23.27.27.16, 11.7.31.15.22, 25.17.2.20.20.3.29.21.3.12, 6.13.31.5.7.26} +{30.8.18.5.20.6.15, 21.15.18.18.30.3.20} +{2.13.9.28, 8.17.25.26.15.25} +{25.22.2.25.6, 3.20.19.10.17.27.3.6.22.23, 11.7.31.15.22} +{18.6.26.2.13.9.6.11.10.11.16, 8.10, 29.3.15.17.12.29, 19.31.14.25.5.8.21.11.13.20, 4.22} +{14.21.5.28.3.32.24.14.25.31, 28.18.6.22.13.8.25, 5.19.1.26.20.6.20, 20.30.17, 29.25.29.16.32.11.15.25.5.22.3} +{20.20.32.29.24.5.5.26.22.32, 29.23.1.21.31.8, 27.27.30.11.15.24.9.7.4.30} +{22.28.20.6.32.32, 1.15.17.6.28.25.24.31.27.9, 2.10.10.4.20.1.12.13} +{28.2.27.1.20, 8.1.29.18.22, 1, 28.26.25.7, 23.23} +{8.9.22, 1.10.21, 27.27.30.11.15.24.9.7.4.30, 24.28.13.26.8.8.31, 27.26.29} +{15.28.24, 20.4.1.16.31.3, 25.18.8.3.23.23.5.9.6} +{28.30.24.16.17.28.2.13.10, 3.32.2.29.3.32.28.11.29.30, 6.14, 30.24} +{24.1.10.20.28.18.6.27.20.30.26, 1.1, 4.3.20.27.9.1.18.30.12.5.19, 16.24.7.25, 1.4.14.32.14} +{29.25.29.16.32.11.15.25.5.22.3, 29.25.29.16.32.11.15.25.5.22.3} +{17.5.3.15.17.13.5, 5.19.1.26.20.6.20, 28.14.32.29.2.3.4, 26.18, 9.26.1.16} +{21.23.13, 15.30.17.5.32.28.2.18.27} +{11.21.16.27.16, 17.11.17.4.8.26.26.20.6, 13.28.12.6, 12.14.20.8.28.4} +{26.31.11.23.3, 23.28.3.30.15.31.32.3.21.9.19} +{22.23.18.18.9.8.23.7.23.23.16, 1.29.18.1.21.12.13.27.32.15} +{30.23.2.13.14.15.29.19.4.12.24, 19.31.14.25.5.8.21.11.13.20, 10.31, 25.17.18.30, 21.18.2.1} +{1.1.7.32.11.22, 6.25.17.32, 18.17.6.16.6.10, 6.6.22.8} +{31.21.14.20.1.22.2.5.3.27.12, 20.23.7.11.11.31.18.16.3, 1.21.28.4.23, 15.17.2.32.7} +{10.11.25.2.24.18.18.21.6.26.21, 5.10} +{4.2.2.32.24.25.31.3, 14.30.13.5.26.9.22.23.14.10, 8.21.17.3.6.3.18} +{24.10.10.31.4.29.9, 18.6.2.2.24, 24.17.24, 2.28.5.17.6.32} +{2.31.25, 22.10.27.19.29.20.29.3.12.14.25, 21.14, 27.26.29, 18.6.26.2.13.9.6.11.10.11.16} +{2.13.9.28, 8.13.1} +{11.10.22.18, 29.27, 21.28.24.23.3.11.7.12.22.32, 25.28.30.24, 4.2.6.20.7.8} +{20.1.24.3.30.31, 24.9.27.16.20.21, 25.5.30.7.16.12.21.12.11.16} +{16.23.30.12.31.31.19.14, 1.16.8.18.14.16.21.25.6, 5.12.2.20.1.24.25, 23.27.6.26.22} +{7.30.5.10.10.5.30.14.9.18, 19.30.18.11.32.14} +{9.22.10.15.5.15, 21.20.28.19.27.9, 3.21.6.13.12.18.25} +{11.22.28.8.12.23.25.15.21.28, 6.27.26.1.20.24.6} +{32.17.8.24.2.14.5.4.22, 16.13.2.19.14.29.31.30.23.15.12, 5.10.3.9.23.30.23, 16.28} +{14.9.15.21.21.31.1.29, 7.12, 28.14.32.29.2.3.4} +{3.18.8.22.7.28.32.31.3, 28.1.3} +{17.14.7.3.2.18.20.23.18.5, 27.5.15.1.15.16.21} +{13.19.2.6.23.19.9.7.21.8.16, 5.21.27.13.14.11.2.16.20, 2.9, 23.20.24} +{19.3.12.12, 5.3.29.9.22, 23.20.12.16.15.2} +{22.10.18, 32.6.9.26.16.4.4.29.7.11} +{23.3.32.21.5.14.10.17.1, 14.4.19.27.28.24.19, 14.12.31, 19.17.13.12.32.16.3} +{1.20.18.25.3.24.25.10.9, 28.14.32.29.2.3.4, 22.26.32, 22.23.22.30, 20.30.17} +{26.16.12.3.27.9.28, 9.22.10.15.5.15, 10.3} +{18.7.3.17.13.5.31.6.31.25.29, 12.24.29.32.32.29.2} +{13.28.12.6, 9.6.9.21.6.11.29.13.29.20.32} +{3.3, 16.13.2.19.14.29.31.30.23.15.12, 6.18.1.4.18.23, 8.14.19.18, 14.8.15.30.7.29.27.31.4} +{27.1.11.3.25.9.6.6, 19.26.24.27.6.24.16.27.32.29, 24.24, 26.32.21.31.27.12, 24.9} +{9.10.19.18.15.11.22.32.32.14.9, 7.10.17.21.11.29.17.25.19.4.29, 19.11.10.18.14.13.7.7, 8.16.6} +{4.26.2.2, 13.28.12.6} +{5.9.19.6, 29.26.25.14.24.18.2.13.23.29, 18.27.11.27.9.16.7.6.22.26.27} +{32.3.23.7.2, 21.14.22.29, 22.32.6.6.3.8.24.6.25.29} +{30.31.13.9, 5.13.23.19.28.26.27.6.1.22, 21.18, 8.13.9.31.20.20.24.7.23.31.28} +{11.10.22.18, 27.6.13.24.21.27.28.22.3.7.4} +{23.3.20.24, 27.24.11.31.21.6.29.17.24.18} +{22.10.18, 8.27.3.4.12.26.16, 3.10.27.4.5.6.19.12.28.12} +{6.13.31.5.7.26, 16.13.2.19.14.29.31.30.23.15.12, 29.23.1.21.31.8} +{22.12.22.28, 26.18.32.20, 1.10.23.25.5.11, 3.11.18.21.5.20.30, 18.31.26.18.6.15.18.11} +{7.7.22.24.17.32.17.25.28, 30.23.10.1.10.7.22.28.18.11.17, 14.19.30.6.4.10.10.10.22.25.11, 8.17.9.15.21.28.1.7.1.3.6} +{25.10.29.3.6.21.3.31.13, 9.3.31.18.12.3.9.29.10, 5.27.32.21.5.1.11.14} +{8.5.30.29.9.31, 6.2.32, 18.27.11.27.9.16.7.6.22.26.27, 22.29.29.11} +{32.16, 18.19.11.20.13.13.11, 20.25.22.19.22} +{1.27.22.23.2.26.32.17.7.9, 1.14.3.7.3.17.2.29, 13.24, 13.30.24, 31.18.27.15.20.29.29} +{19.26.32.13.1.12.30.26.22.25, 1.3.15.11.11.25.24.21.19, 20.32.5.1.3.20.3.30.27, 23.12.32.22.19.1.22.4, 12.4.24.6.1.13.5.20} +{4.26.5.26.21.28.17.24.25.23, 30.8.9.14.25.30, 31.18, 1.14.3.7.3.17.2.29, 11.11.9.30.15.29.15.18} +{17.14.7.3.2.18.20.23.18.5, 29.3.15.17.12.29, 17.1.12.20, 14.14.25, 6.17.26.25.27.11.10.9} +{9.9.13.9.14.27, 29.3.17.17.18.32} +{32.1.23.20.14.12.23.5.32.15, 23.1.23.18.12.29, 1.1.1, 6.7.7} +{29.5.18.27.3.21.18.6.14, 15.7.5.12.7.9.3.28.26, 11.17.10, 19.26.32.13.1.12.30.26.22.25} +{5.13.23.19.28.26.27.6.1.22, 21.10.20.9.3.16.9.10.20, 1.21.28.4.23, 22.19.5.22.20.31.23.24.14.24.4} +{2.22.19, 3.29.32.26.8.10.25, 25.11.24, 10.3} +{16.14.3.17.17.26.12.19.19.30, 16.13.2.19.14.29.31.30.23.15.12} +{10.31, 18.19.11.20.13.13.11} +{19.16.31.31.29.12, 30.2.17.8.14, 23.14.30.27.28.26.26.23.8.32, 19.3.12.12} +{8.16.6, 26.14.5.32.10, 24.31.2.13.5.23.18.16, 24.27.18.32.14.9.11.28.9, 3.29.19.2.24} +{24.15.15.17.22, 4.14} +{29.20.1.11.21.16.1.2.14.28, 14.27.29.23.4.1.17.32.6.25.22, 3.27.18.8.4.21.6.32.30.7.5, 4.26.23.6.19.31.10.4.22} +{22.13.22.8.30.32.10.24, 26.28.14, 12.4.26.23.25.5.15.7.16} +{21.14.25.20.13.31.14.20, 5.4.8.25.12.27.2.29.28.3, 23.24.11.31.10.31.18.28.13.18.6, 6.18.1.4.18.23, 19.17.12.15} +{10.12.23.22.23.22.20.17.17.9, 17.14.7.3.2.18.20.23.18.5, 3.10.4.5.28.11, 12.2.4.28.21.30.24} +{12.4.24.6.1.13.5.20, 24.25.7.27.30.8.26.17} +{20.4.1.16.31.3, 22.18.20.23.15.9.12, 25.10.4.28.3.31.19, 2.28.5.17.6.32} +{17.3, 31.7.14.2} +{19.3.23.4.4.21.23, 32.28.1.32.28.10, 25.4.32} +{31.28.32.4.31.4.7, 23.8.13.22.21, 5.21.27.13.14.11.2.16.20} +{21.17.18.32.7.8, 20.32.9, 19.26.32.13.1.12.30.26.22.25, 16.14.3.17.17.26.12.19.19.30, 8.31.22.27} +{27.4.15.14.19.6.12, 30.30.17.5.30.21.19.5.22.22.14, 26.17.9.13.4.25.32.2.24.9, 8.10, 12.24.29.32.32.29.2} +{5.21.27.13.14.11.2.16.20, 5.31.8.1.5.13.21.28.29.19.2, 25.2.3.15.11.19.5.28.25.14} +{8.5.24.9.29.32.31.30.13.9.7, 1.29.18.1.21.12.13.27.32.15, 32.15.20.28.5.1.23.4, 32.6.31.31} +{6.29.32.13.30.3.16, 24.17.24} +{5.10.2.11.21.9.19, 7.31, 10.20, 29.9.25.27.15.16.32.26.6.32} +{12.13.5.31, 7.19.12.3.21.19.18.5.2.14.10} +{20.9.29.32.13.7.23, 23.24.16.32.13.29, 9.7.31.11.8.23, 26.5.29.7.28, 1.1.1} +{9.6.9.21.6.11.29.13.29.20.32, 1.20.22.26.2.6.11} +{7.7.22.24.17.32.17.25.28, 13.7, 1.20.18.25.3.24.25.10.9, 9.5} +{9.8.23.2.20.16, 30.17.25.3.31.11.3.4.1.10, 6.19.29.11.2.32.21.15.32.9, 18.29.5.1.10.21.2} +{25.6.12.16.1, 11.10, 22.17.30, 1.28.19.8.25.6.20.27.29.27, 9.3.3} +{9.3.3, 15.7.3.14.23.19.26} +{27.21.28.24.7.2.24.23.8, 12.4.12.13.25.30.30.8.9.12, 9.18.23, 19.12.26.24.29.3, 26.14.5.32.10} +{25.24.2.32.14.18.16, 23.27.6.26.22, 32.30.18.17.1.14.12.18, 3.18.18} +{28.30.24.16.17.28.2.13.10, 11.17.10, 16.30.10.7.29.4.9.21.22.13.26} +{3.26, 22.17.24.14.21.15.12.18.17.25.11, 10.32.14, 23.12.19.25.16.23.22.6.29.4} +{14.24, 2.19.4.1.15.7.8.9.17.29, 13.24, 18.13.9.3.18.15.2, 10.28.7.16.31} +{26.32.8.12.30.19.24.8.6.1.10, 23.28.20.25.30.24.15, 6.11.31.23.12.8.30.14.27, 3.9.11.23.32.26.24.28, 6.11.11.5.16.8.14.12.9} +{8.3.3.25.25.15.7.13.21.18, 27.32.26.21.31.17.32.32, 13.3.8} +{15.7.3.14.23.19.26, 26.26.22.21.14.11.29.19.14.24, 8.3.18.13.30.20.27.26.17.28, 4.11.22.4.19.24.4.28.6.8.22} +{25.32.24.24.28.15.16.10, 12.21.20.20, 20.8.19.14.16.7, 18.13.6.12.26.26.26.29.18.20.1} +{8.1.29.18.22, 31.18.32.11.7.25.20.5, 5.15.10.3.23.13.32.23, 26.31.7} +{22.10.18, 3.21.16.24.23.12.16.32.3, 24.16.27.10.9} +{8.27.3.4.12.26.16, 9.14.27.31.26.21.25.3.20, 27.18} +{4.21.9.1.2.14.8.17.13.26, 17.11.17.4.8.26.26.20.6, 30.25.24.22} +{9.7.31.11.8.23, 15.5.1.31.28.10.8, 19.15.26.19, 20.22.10, 8.2.18.23.5.16.17.1} +{15.5.1.31.28.10.8, 12.11.20.20.29} +{32.25.16, 29.20.1.11.21.16.1.2.14.28, 3.29.19.2.24, 5.5.12.31.23.13.17.22.20} +{23.5.5.17, 23.12.11.11.15.16.22.31.32.5.8} +{26.24.9.12.11.15.31.2, 18.13.9.3.18.15.2, 28.4, 27.30.12.11.20.15.11.13, 8.3.3.25.25.15.7.13.21.18} +{16.5.23.17, 13.25.10.25.8.16, 1.16.8.18.14.16.21.25.6, 5.14.29.2.23.16.20.22, 8.13.14.11.11.29.22.4.4.10} +{9.8.23.2.20.16, 16.24.7.25, 3.9.11.23.32.26.24.28, 30.17.2.25} +{32.1.31, 17.17.14.28.6.30} +{3.3, 31.5.6.4.8.29.3, 28.26.25.7, 1.26.15.23.5.31.29.11.19.28.1} +{24.9.27.16.20.21, 28.2.27.1.20, 32.17.8.24.2.14.5.4.22} +{12.16.2.4.15, 16.13.19.11.18.13.17.17, 25.2.3.15.11.19.5.28.25.14} +{8.22.32.17.16.28.31.23.22.9, 18.31.32.28.1.4.24.24.12.25, 23.10.5.26.12.4.20.4, 28.17.26.9} +{24.2.6.7.16.7.28, 10.16.19.7.15, 3.14.1.14.17.28.29.16, 12.17.10.7.17.16} +{19.31.14.25.5.8.21.11.13.20, 21.23.13, 2.30.26.10.14.31.18.2} +{21.4.11.18, 13.7, 30.8.18.5.20.6.15} +{28.15.18.27, 11.10, 7.13} +{11.29, 29.9.25.27.15.16.32.26.6.32, 7.23.1.24.29.13.31.19.23.17.7, 7.30.19.25.23.15.14.29, 23.12.32.22.19.1.22.4} +{22.11, 21.32.13.21} +{22.31.2.32.32.11.26.23.19, 1.20.22.26.2.6.11, 32.24.11.8.12.23.22.19.11.17.18, 3.10, 18.21} +{12.7.16.8.21.22.2.16.18, 1.30.18.31.12.25.4.19.28.12.15} +{19.26.32.13.1.12.30.26.22.25, 29.3.17.17.18.32, 12.1.28.22.25, 18.4, 14.8.15.30.7.29.27.31.4} +{11.17.10, 32.17.8.24.2.14.5.4.22, 22.29.18.32.13.12.22.31.17.22} +{2.15.18.21.5.21.4.7.30, 4.14.32} +{15.17.2.32.7, 25.24.2.32.14.18.16, 28.9.3.16.17.21.23.30} +{3.5, 1.10.5.22.13, 4.15.20.23.12.16.2.16.17} +{24.9.8.12.29, 27.5.22, 15.3.31.9.27.14.9.8.14.6.32, 10.32.14, 23.24.11.31.10.31.18.28.13.18.6} +{10.22.30.16.2.21.17.13, 32.1.24.29.22.5.9.24.18.3.13, 32.31.26.19.13.29.4.25, 27.3.3.11.21.4.25} +{21.6.22.28.12.23.11.22, 22.11} +{8.5.24.9.29.32.31.30.13.9.7, 19.20.25.7.27.28.27.17.9.3.1} +{9.7.31.11.8.23, 7.13} +{12.23.3.19.29.15.12.6, 7.12.23, 30.12.6.30, 19.16.26.2} +{15.11.26.1.30.6.23.5, 31.21.22.14.8.21} +{2.32.8.28.24.20.9.24.25.8.9, 22.23.18.18.9.8.23.7.23.23.16, 26.12.27.2, 22.23.25.28.5.27.9.9.24.31.10} +{2.24.5.3.4.10.27.26.17.28.16, 4.19.16.15.5.2.25.8.28.14.2, 32.31.26.19.13.29.4.25, 18.31.32.28.1.4.24.24.12.25, 30.24.23.25.32.18.22.12.29.9.22} +{21.28.24.23.3.11.7.12.22.32, 16.8.29.7.21.2.3} +{23.12.19.25.16.23.22.6.29.4, 19.6.24.32.30.13.6.25.8.28, 24.1.29.32.14.15.32.6.15.22, 23.27.27.16, 28.5.12.9.2.27.11.11.2} +{24.9.27.16.20.21, 25.17.18.30, 15.28.24, 24.20.23, 17.29.21.10.18.8.16.26.18.21.26} +{1.4.14.32.14, 17.17.14.28.6.30} +{4.11.22.4.19.24.4.28.6.8.22, 6.19.6.4.9.11.32.17.17.3.15, 15.8.3.15.27.14.29.28.6.5.25, 28.14.32.29.2.3.4, 21.18} +{18.30.18.31, 23.27.6.26.22, 12.4.26.23.25.5.15.7.16, 25.4.4.1.13.32.26.20.20.3, 6.1.8.6.30.29.30} +{20.30.9.9.14.12.29, 29.28.9.15.8.27.31} +{27.23.20.30.7, 18.24.21.17.11.26.28.22.21.18.10, 8.21.17.3.6.3.18, 4.13, 22.19.20.5.2.20} +{27.12.4.2.29.22.15, 4.13} +{32.6.13.8.32, 23.12.1.5.32.25.8.24.1.25, 1.8} +{18.9.21.2.31.8.32, 10.22.30.16.2.21.17.13} +{1.21.28.4.23, 4.14.10.19.16, 1.29.18.1.21.12.13.27.32.15, 26.14} +{10.29.26.4.27.17.11, 10.28.22.29.13.19.6.7.6.14} +{25.28.3, 24.17.24, 2.13.9.28, 4.22.17.10.19.9.8.19.28.3.9} +{3.25, 14.4.23.4.23.22.11.6.26.5, 19.3.12.12, 15.7.3.14.23.19.26, 28.14.32.29.2.3.4} +{25.15.11, 5.20} +{15.28.30.19.31.6.2.2.31, 5.10, 32.1.23.20.14.12.23.5.32.15, 31.30.12.20} +{13.26.17.3.2.19, 6.7.25.16.13.21.7.20.25.12.4, 3.11.32.11.22.3.7.17.8.13.23, 30.20.3.2.5.15.8.7.17, 25.11.24} +{1.27.22.23.2.26.32.17.7.9, 8.6.6.5.8.8.12, 9.16.2.16.22.24.17.31.14.21.17, 17.13.8} +{6.20, 19.16.26.2} +{27.29.1.5.30.6.22.16.23.2.28, 8.5.30.29.9.31, 31.24.26.18} +{18.18.5.11.7.4.25, 17.29.21.10.18.8.16.26.18.21.26} +{25.17.2.20.20.3.29.21.3.12, 7.21.8} +{8.25.20.3.15.24.7.4.24.5.30, 31.17, 2.31.25} +{26.9.17.1.18.19.1.11.18.29.3, 4.3.20.27.9.1.18.30.12.5.19, 29.27.13.9.28.29.19.13.29.31.27} +{15.1.8, 9.28.10.26.14.26.15.14} +{9.10.32, 21.28.17.22.10.27.4.20.2.32} +{25.15.11, 29.9.25.27.15.16.32.26.6.32, 20.8.19.14.16.7, 24.32.17.23.24.19.23.9.20.18, 9.7.31.11.8.23} +{16.5, 14.23.31.5.5.15.17.12.17.7.3, 5.24.25.15.27.30.20, 1.22.29.5.16, 28.25.29.4.13.5.6} +{8.16, 32.6.15.26.14.15.3.19, 8.26.29.13.7.25.31.28.3.32, 12.21.15.27.24.15.8.24.24.26} +{10.11.25.2.24.18.18.21.6.26.21, 19.31.14.25.5.8.21.11.13.20} +{4.14, 1.18.29.30.22.14.3.20.15.21.20, 20.17.14.7, 1.26, 22.17.9.11.25.15.3.9} +{7.16.20.17, 27.11.15.9.24.31.18.4.1.30.20, 29.10.17.11.28.12.18.5.19.15.21} +{16.5, 8.5.30.29.9.31, 12.4.24.6.1.13.5.20, 25.11.24} +{22.28.20.6.32.32, 24.31.2.13.5.23.18.16, 1.30.18.31.12.25.4.19.28.12.15, 23.17.22.1.23.4.29.32.4.1} +{26.18.32.20, 27.17.3.18.2.13.18, 1.26.15.23.5.31.29.11.19.28.1, 26.12.27.2, 12.18} +{14.16.6.29.26.13.14.16.25.26.8, 30.25.24.22, 25.18.8.3.23.23.5.9.6, 10.29.26.4.27.17.11} +{3.25, 10.3.19, 4.14.32, 30.16.3.21.10} +{24.32.27, 3.1.14.8.9.16.30.22.20} +{1.18.29.30.22.14.3.20.15.21.20, 8.3.18.13.30.20.27.26.17.28, 17.25.10.13.21.5.7.22.2} +{31.24.26.18, 9.30} +{1.29.18.1.21.12.13.27.32.15, 5.14.27.15.11.17.3.10.27.25, 16.5, 28.14.24.26.6.15.16.32.25.13.8, 15.7.3.14.23.19.26} +{5.24.24.9.32.26.31, 4.21.28.5.16.29.5.21, 26.24, 1.19.22.11.14.7.32.23.19.14, 11.17.17.24.11.23.17.17.18.10.22} +{24.9.15.1.14.29.6.4, 21.23.17.8.23.11.8.1, 18.6.2.2.24, 25.32.24.24.28.15.16.10, 8.10} +{3.14.11.15.21.32.2.15.13, 4.1.24.24.28.24.18} +{6.29.6.13.14.24.10.4.14.28, 19.12.30.2.21, 26.24.9.12.11.15.31.2} +{4.13, 6.9.29.17.4.32, 1.22.29.5.16, 28.15.25.7.13.6.19.2} +{16.20.29.26, 11.22.28.8.12.23.25.15.21.28, 7.5.28.8.17.26.31.10.15, 27.17.17.19.24.9.14.20} +{20.17.18.21.1, 14.15.31.29, 6.19.3} +{5.24.4.31.3.16.25.17.13.26.11, 23.24.16.32.13.29, 23.24.16.32.13.29, 23.23, 24.28.13.26.8.8.31} +{1.27.22.23.2.26.32.17.7.9, 25.16.9.6, 11.6.11.29.4.5.24.6.26.12, 23.24.11.31.10.31.18.28.13.18.6} +{31.17.2.30.11, 7.7, 9.30, 7.31, 9.31.23.19.5.10.16.4.30.24.5} +{23.5.5.17, 15.31.11.27.19.19.20.5.5, 15.9.11.20.22.15.11.13} +{9.22.10.15.5.15, 4.15.20.23.12.16.2.16.17, 16.14.3.17.17.26.12.19.19.30, 9.3.3} +{18.31.26.18.6.15.18.11, 1.26} +{16.13.19.11.18.13.17.17, 18.7.10.27.17.24, 14.14.25, 31.18.32.11.7.25.20.5, 6.17.10.10.7.9.27.8.29} +{22.29.18.32.13.12.22.31.17.22, 16.24.7.25} +{14.24, 12.3, 31.4.7, 14.6.10.29.25.26.20.24.24, 21.6.22.28.12.23.11.22} +{12.4.10.17.4.10.23.3, 21.17.18.32.7.8, 4.16.22.19.24.21, 27.23.2.32.11.21, 2.1.3.30.24.17.9} +{10.15.16.3, 3.18.18, 30.27.8.6.11.19, 1.1.1.2} +{15.7.3.14.23.19.26, 24.27.14} +{4.22.17.10.19.9.8.19.28.3.9, 30.27.8.6.11.19, 18.13.9.3.18.15.2} +{31.18.25.1.14.29.25.5.22.30, 8.26.29.13.7.25.31.28.3.32} +{4.2.6.20.7.8, 7.30.5.10.10.5.30.14.9.18, 20.30.9.9.14.12.29, 18.13.9.3.18.15.2, 24.31.2.13.5.23.18.16} +{31.30.23.7.7.24.32.10.11.1.31, 2.32.10.13.12, 13.8.15.3.7.31.5.10.15.30, 13.16.4.28, 16.5.12.5.15.12.24.25.3} +{28.23.2.30.3.8.1.15.15.14.13, 7.11, 31.17, 26.14, 28.4} +{16.13.19.11.18.13.17.17, 29.5.32.20.11.7.13.24.17, 4.21.28.5.16.29.5.21} +{11.16.16.28.14, 25.16.9.6, 5.10.2.11.21.9.19, 32.16, 16.13.19.11.18.13.17.17} +{1.26, 26.13.4.7.13.11.3} +{12.11.20.20.29, 21.32.13.21, 12.3} +{20.6.3.26.7.29.28.4, 1.1.3, 14.21.5.28.3.32.24.14.25.31} +{3.10, 22.10.16.8, 28.1.3} +{15.1.8, 29.27.7.7.3.11.14.26.21.11, 7.31.2.28.15.11.17.18.19.23.6, 12.17.10.7.17.16} +{8.29.6.3, 8.14.19.18, 6.10.25.12, 1.1.2.1} +{31.13.9.1.5.12, 27.22.11.13.21.25.5.1.27.21.27} +{20.6.3.26.7.29.28.4, 6.13.31.5.7.26} +{29.6.12.31.20.23.32.20, 17.14.7.3.2.18.20.23.18.5, 20.8.19.14.16.7, 22.17.7.30.13.24} +{32.3.23.7.2, 3.26, 17.8, 8.13.1, 17.13.8} +{27.18, 29.32.13.4.1.16.20} +{14.30.23.3, 2.24.5.3.4.10.27.26.17.28.16, 6.29.32.13.30.3.16} +{22.17.9.11.25.15.3.9, 17.11.17.4.8.26.26.20.6, 4.2.2.32.24.25.31.3, 8.25.20.3.15.24.7.4.24.5.30, 4.3.6.27.22.23.10} +{27.5.15.1.15.16.21, 25.9.1.5.9.11.25.4.11.27.32, 21.7.7.11} +{2.32.8.28.24.20.9.24.25.8.9, 30.15, 13.28.12.6, 29.27} +{22.19.5.22.20.31.23.24.14.24.4, 8.9.25.25.26.30.31.31.2.32.7, 16.5.10.2.18.8.15.12.32.25.10, 9.9.13.9.14.27, 11.1.3.28.30.21.24.14} +{7.11, 28.1.3, 4.2.2.32.24.25.31.3} +{5.27.21.1.29.29.28, 30.23.10.1.10.7.22.28.18.11.17, 17.3, 1.12.25.26.22.8.15.23} +{4.15.20.23.12.16.2.16.17, 32.16, 29.5.18.27.3.21.18.6.14, 9.31.4.14.31.10.17.5.2, 17.8} +{9.30, 4.30.8.20.19.9.30.24.11, 13.3.8} +{23.5.7.12.11.23.10, 10.29} +{20.32.9, 20.20.7, 19.7.29.31.3.20.7.21.25.27.29, 24.1.10.20.28.18.6.27.20.30.26} +{22.23.22.30, 19.17.13.12.32.16.3, 6.1.8.6.30.29.30, 1} +{30.25, 8.2.18.23.5.16.17.1, 28.30.24.16.17.28.2.13.10} +{32.1.24.29.22.5.9.24.18.3.13, 13.14.13.10.28.26.9.18.27.21, 25.21.8.17, 27.27.25.10.31.10.21.22.21.16.12} +{6.9.29.17.4.32, 7.32.10.3.30.12.14, 25.22.2.25.6, 25.9, 17.11.17.4.8.26.26.20.6} +{21.7.7.11, 4.2.2.32.24.25.31.3, 12.4.12.13.25.30.30.8.9.12, 21.23.13, 19.16.31.31.29.12} +{1.8, 31.13, 19.6.24.32.30.13.6.25.8.28} +{26.16.12.3.27.9.28, 24.2.6.7.16.7.28, 19.6.24.32.30.13.6.25.8.28} +{27.17.17.19.24.9.14.20, 4.14.32} +{16.9.32.14.3.7.8.7.21.22, 14.21.6.5.26.9.32.16.25, 25.32.24.24.28.15.16.10, 19.22.29.32.1.21.26.24.23.17, 12.27.23.32.1.1.9.29.13} +{1.1.1.1, 14.21.5.28.3.32.24.14.25.31, 30.23.2.13.14.15.29.19.4.12.24} +{5.24.4.31.3.16.25.17.13.26.11, 4.16.7.25.21.7, 17.5.3.15.17.13.5} +{20.20.7, 1.12.25.26.22.8.15.23, 5.14.29.2.23.16.20.22, 4.19.16.15.5.2.25.8.28.14.2, 11.30} +{28.23.2.30.3.8.1.15.15.14.13, 5.12.2.20.1.24.25, 28.14.24.26.6.15.16.32.25.13.8} +{8.9.21.16.29, 23.3.32.21.5.14.10.17.1, 24.1.29.32.14.15.32.6.15.22, 32.16, 3.18.18} +{19.2.9.29.6, 31.30.12.20, 31.21.14.20.1.22.2.5.3.27.12, 1.30.31.31.20.16.7, 24.16.27.10.9} +{7.19.10.12.31.1.27.13.19, 25.10.29.3.6.21.3.31.13, 20.13} +{23.24.16.32.13.29, 12.22.20.4.12, 25.28.3, 18.19.11.20.13.13.11, 32.27.18.7.3.4.2} +{27.25, 29.23.15.25.1.6.6.10, 6.21.30.7, 32.6.8, 2.27.15.14} +{5.21.27.13.14.11.2.16.20, 12.21.15.27.24.15.8.24.24.26, 25.7.3.21.31.12.28} +{27.25, 18.19.11.20.13.13.11, 27.6.13.24.21.27.28.22.3.7.4, 1.27.22.23.2.26.32.17.7.9} +{24.12, 28.15.25.7.13.6.19.2} +{17.3, 13.32.15.32.26.14.32, 22.17.9.11.25.15.3.9, 3.27.18.8.4.21.6.32.30.7.5, 3.18.8.22.7.28.32.31.3} +{6.8.7.20.2, 16.13.26.18.9.29.11.17.1.24.26, 31.13.9.1.5.12, 22.17.9.11.25.15.3.9} +{13.9.9.27.31.11.25.9.27.22.13, 32.15.20.28.5.1.23.4, 15.23.26.20.27.7} +{23.17.28.31.28, 14.1.11, 4.22.7.19.25, 31.5.6.4.8.29.3} +{10.12.9.6.6.26.14.8.23.1.25, 19.11.10.18.14.13.7.7} +{3.4.22.19, 26.24, 14.4.23.4.23.22.11.6.26.5} +{2.1.12.19.29.28.3.31.28.28.10, 15.29.25, 8.16.30.29.19.22.28.24.2, 23.27.27.16} +{27.4, 23.10.5.26.12.4.20.4, 25.7.3.21.31.12.28, 14.19.30.6.4.10.10.10.22.25.11} +{25.10.4.28.3.31.19, 31.30.12.20, 27.3.3.11.21.4.25, 6.17.26.25.27.11.10.9, 29.29.18} +{8.9.22, 21.23.17.8.23.11.8.1, 24.1.10.20.28.18.6.27.20.30.26, 31.18.32.11.7.25.20.5, 22.31.2.32.32.11.26.23.19} +{27.5.15.1.15.16.21, 16.2.14.3.26.11, 9.6.9.21.6.11.29.13.29.20.32} +{21.1.4.9.9.31.24.21.3.29, 18.19.12.20.18.17.15.32.18.5} +{29.23.1.21.31.8, 21.18, 8.5.24.9.29.32.31.30.13.9.7, 16.28, 21.5.11.18} +{19.16.31.31.29.12, 2.15.14.20.30.26, 26.19.3.14.8.28.31.10, 5.24.25.15.27.30.20, 24.31} +{26.11, 5.19.1.26.20.6.20, 23.22.10.1.14.24, 11.17.17.24.11.23.17.17.18.10.22} +{28.6.8.22.25, 22.19.5.22.20.31.23.24.14.24.4} +{14.10.11.30.5.7.6.24.9.30.26, 3.18, 4.21.9.1.2.14.8.17.13.26, 3.29.19.2.24, 24.9.15.1.14.29.6.4} +{10.11.25.2.24.18.18.21.6.26.21, 9.28.24, 23.28.3.30.15.31.32.3.21.9.19, 18.29.13.24.18.3.12.18.12.12} +{25.24.2.32.14.18.16, 21.32.13.22.3.13.31.23.14.12.9} +{11.10.22.18, 4.2.16.13.16.11.19.10.10.25, 7.23.15.32.28.27.2.2.26, 6.10.25.12} +{12.23.3.19.29.15.12.6, 7.31} +{13.3.20, 32.8.29.18.31, 30.3.16.26.7.27.26.9.27.21.18, 8.9.21.16.29, 22.30.31.24.23.22.5.20.28.1} +{23.22.23.14.31.32, 3.5} +{7.19.10.12.31.1.27.13.19, 20.17.18.21.1} +{12.2.4.28.21.30.24, 23.25.23.11.7.23, 16.27.8.17.14.17.21.29.14, 7.19.12.3.21.19.18.5.2.14.10, 27.30.12.11.20.15.11.13} +{16.29.6.23.13.28.31.6.19.26.15, 20.30.9.9.14.12.29, 15.4.15, 9.6.9.21.6.11.29.13.29.20.32} +{16.19.17.30.30.5.17.24.27, 2.8.13.12.17.23.16.7.11.23, 6.17.26.25.27.11.10.9, 23.28.1, 21.21.10.27} +{6.27.26.1.20.24.6, 7.11, 9.14.27.31.26.21.25.3.20, 24.23.24.4.15.25.17, 21.8.9} +{28.6.11.6.15.22.12.6, 15.29.25, 12.15.10.17.18.13, 9.7.31.11.8.23} +{12.14.20.8.28.4, 20.4.27.31.1, 8.13.6.12.18.7, 29.10.12.17.12.16} +{29.5.18.27.3.21.18.6.14, 23.20.24, 17.7.26.30.18.23.4, 1.1.1.2.1} +{3.14.1.14.17.28.29.16, 1.13.16.27.11.16.30.2.9.18.4} +{22.23.22.30, 13.9.9.27.31.11.25.9.27.22.13, 19.2.26.21.16.11.2.2, 16.5.23.17} +{30.24.23.25.32.18.22.12.29.9.22, 22.19.21.11.6.8.29.24} +{25.30.1.4.24.11, 16.2.14.3.26.11, 12.6.14.23.19.21.9.12, 17.24.30.6.32} +{19.26.24.27.6.24.16.27.32.29, 13.32.15.32.26.14.32, 8.2, 12.15.10.17.18.13, 13.16.1.27.18.18.19.6.14.4} +{16.29.6.23.13.28.31.6.19.26.15, 21.32.13.21, 30.32, 18.6.26.2.13.9.6.11.10.11.16} +{14.5.13.19.25.12.32.9.13.16.12, 22.23.25.28.5.27.9.9.24.31.10, 26.14, 23.19.17.31.29.13.1.12.5.25, 18.6.26.2.13.9.6.11.10.11.16} +{21.15.31.24.29.24.26.12.20, 15.1.6.31.30.13.32.9.10, 9.9.13.9.14.27, 19.10.26.19.5.21.30.23, 2.9} +{28.6, 24.11.5, 18.18.19.16.14.16.21.10.25} +{5.3.29.9.22, 27.3.3.11.21.4.25} +{20.22.10, 25.15.11} +{5.15.10.3.23.13.32.23, 11.12.6.21} +{1.16.8.18.14.16.21.25.6, 2.4.25.32.16.22.26.13.17.18} +{10.7.9, 2.32.10.13.12, 17.13.19.31.12.18.10.15.14, 4.3.20.27.9.1.18.30.12.5.19, 3.26} +{17.1.12.20, 18.31.32.29.22.1.31.11.28} +{25.17.2.20.20.3.29.21.3.12, 29.28.9.15.8.27.31, 15.3.31.9.27.14.9.8.14.6.32, 1.22.29.5.16} +{28.26.25.7, 23.5.5.17, 7.19.10.12.31.1.27.13.19} +{8.16.6, 25.2.11.20.8.6.22, 23.12.11.11.15.16.22.31.32.5.8, 26.31.6.8.29.8.24, 15.1.8} +{3.26.32, 28.6.8.22.25, 28.31.10.28.22.26.16.15, 5.15.16, 8.5.30.29.9.31} +{30.12.9.25.24.6.7.24.29, 20.24.14.15.4.21.12.27.4.12} +{24.28.13.26.8.8.31, 23.31.27.16.8.30.20.27, 32.3.12.2, 32.6.8} +{26.9.20.12.22.22.32, 9.10.32, 13.32.15.32.26.14.32} +{30.18.30.16.29, 1.26} +{26.32.21.31.27.12, 27.17.17.19.24.9.14.20, 11.6.11.29.4.5.24.6.26.12, 12.24.29.32.32.29.2, 29.10.17.11.28.12.18.5.19.15.21} +{14.5.13.19.25.12.32.9.13.16.12, 3.21.16.24.23.12.16.32.3, 28.17.26.9, 9.31.4.14.31.10.17.5.2} +{23.20.12.16.15.2, 14.19.26.15.22.23} +{18.15.14, 7.26.18} +{28.15.18.27, 13.8.23.13.11.18.24.21.11.24.10, 8.14.19.18, 8.32.30.1, 15.25.31.11.4.22.16.7.11} +{24.3.23.25, 12.6.14.23.19.21.9.12, 27.11.14.17.24, 23.19.17.31.29.13.1.12.5.25, 6.10.25.12} +{15.17.2.32.7, 12.22.20.4.12, 30.32, 28.11.11.30.20.11.32} +{17.27, 14.12.31, 30.23.10.1.10.7.22.28.18.11.17} +{30.15, 22.24.22.25.15.23.13, 9.3.31.18.12.3.9.29.10, 20.4.27.31.1} +{24.28.32.21, 25.16.9.6, 24.9.27.16.20.21, 5.15.16} +{22.26.32, 16.14.3.17.17.26.12.19.19.30, 16.5} +{29.1.7.26.25.11.22, 6.17.10.10.7.9.27.8.29, 30.12.6.30, 4.26.5.26.21.28.17.24.25.23} +{10.29.26.4.27.17.11, 29.11.20.22.27} +{18.9.21.2.31.8.32, 24.17.31.20.12.9.19.29.18, 19.19.25.22.11.6.15.3.2.19, 30.8.18.5.20.6.15} +{27.21.27.5.13.30.17, 5.18.9.25.31.21.22} +{11.32.18.31, 6.14, 1.13.16.27.11.16.30.2.9.18.4, 31.9.3.5} +{29.5.18.27.3.21.18.6.14, 23.24.16.32.13.29, 29.30.7.31.22, 12.27.30.12.24.2.20, 7.30.5.10.10.5.30.14.9.18} +{26.5.29.7.28, 2.31.25, 12.16.2.4.15, 4.11.22.4.19.24.4.28.6.8.22} +{8.16.6, 12.29.26.18.4.21.28.8.13.3, 22.10.16.8, 27.2.10.4.25.14.2.15.4, 30.32} +{12.29.17.2.20.29.1.11.19.8.12, 31.9.3.5, 24.9.15.1.14.29.6.4} +{14.21.6.5.26.9.32.16.25, 9.8.23.2.20.16, 29.10.12.17.12.16, 4.2.2.32.24.25.31.3, 32.15.20.28.5.1.23.4} +{8.16, 30.23.2.13.14.15.29.19.4.12.24, 4.26.23.6.19.31.10.4.22, 10.11.25.2.24.18.18.21.6.26.21} +{14.4.19.27.28.24.19, 9.3.3} +{24.3.23.25, 21.7.7.11, 14.14.25} +{1.22.29.5.16, 29.28.9.15.8.27.31, 22.11} +{23.28.3.30.15.31.32.3.21.9.19, 12.14.20.8.28.4, 2.30.26.10.14.31.18.2, 24.9} +{10.12.23.22.23.22.20.17.17.9, 7.5.28.8.17.26.31.10.15, 29.15.29.8.31.26.1, 9.5.9.3.23.9.25.14.1.29.28} +{4.21.28.5.16.29.5.21, 1.30.18.31.12.25.4.19.28.12.15} +{3.25, 7.30.5.10.10.5.30.14.9.18, 16.20.29.26} +{9.22.10.15.5.15, 24.25.7.27.30.8.26.17, 14.10.11.30.5.7.6.24.9.30.26, 2.15.18.21.5.21.4.7.30, 15.1.6.31.30.13.32.9.10} +{14.19.20.13.27.2.2, 1.3.15.11.11.25.24.21.19, 7.30.5.10.10.5.30.14.9.18, 23.24.11.31.10.31.18.28.13.18.6} +{26.24.9.12.11.15.31.2, 15.7.3.14.23.19.26, 4.11.22.4.19.24.4.28.6.8.22} +{17.29.21.10.18.8.16.26.18.21.26, 32.3.12.2, 21.28.24.23.3.11.7.12.22.32, 10.8.20.11.12.23.22} +{23.19.17.31.29.13.1.12.5.25, 19.11.10.18.14.13.7.7, 24.15.15.17.22} +{5.15.10.3.23.13.32.23, 18.31.32.28.1.4.24.24.12.25, 25.28.3} +{30.30.17.5.30.21.19.5.22.22.14, 1.3.15.11.11.25.24.21.19, 5.8.17.30.15.8.19.29.30.11.6, 13.28.9.3, 3.25} +{1.22.19.24.8.11, 7.30.5.10.10.5.30.14.9.18, 10.3.19, 23.8.13.22.21} +{10.7.9, 7.32.10.3.30.12.14, 27.22.11.13.21.25.5.1.27.21.27} +{30.17.2.25, 1.20.22.26.2.6.11, 14.19.30.6.4.10.10.10.22.25.11} +{22.23.25.28.5.27.9.9.24.31.10, 23.22.10.1.14.24, 15.23.26.20.27.7, 5.3.17.29, 1.10.23.25.5.11} +{12.10, 18.24.21.17.11.26.28.22.21.18.10} +{25.10.29.3.6.21.3.31.13, 7.7.25.22.22.26, 1.27.22.23.2.26.32.17.7.9, 1.31.3} +{30.22.29.21.19.14.3.2.6, 27.25, 6.25.17.32} +{1.30.31.31.20.16.7, 26.5.29.7.28, 23.17.28.31.28, 11.6.11.29.4.5.24.6.26.12} +{10.3, 16.9.14.28.6.21.31.31.26, 23.19.17.31.29.13.1.12.5.25, 24.16.27.10.9} +{17.1.12.20, 14.3.17.1.14.15.21.4.26, 13.1.6.17.28.9.15.30.1.27.14} +{19.22.21.13.27.13.15, 24.2.6.7.16.7.28, 13.9.9.27.31.11.25.9.27.22.13, 31.21.22.14.8.21, 7.27.20} +{9.28.10.26.14.26.15.14, 30.12.6.30, 23.31.27.16.8.30.20.27, 18.18.19.16.14.16.21.10.25} +{3.14.11.15.21.32.2.15.13, 30.25, 7.14.22.29.30.14.25.1.9.26.25, 3.5} +{22.10.18, 31.17.2.30.11, 28.14.32.29.2.3.4, 11.21.13.9.19, 21.30.19.6.28.1.32.2.14.14} +{26.31.6.8.29.8.24, 25.28.3, 15.30.17.5.32.28.2.18.27, 1.1.1.2} +{12.15.10.17.18.13, 22.19.20.5.2.20, 30.2.17.8.14, 30.12.9.25.24.6.7.24.29} +{32.1.21.1.16.29.21, 14.2.14.11.12, 12.17.10.7.17.16} +{29.5.18.27.3.21.18.6.14, 3.27.18.8.4.21.6.32.30.7.5} +{29.15.29.8.31.26.1, 16.31.12.27.25.9.32.29, 2.13.9.28, 9.5} +{15.10.30.1.4.12.8.20, 2.16.3.7.22.18.29.20, 26.31.7} +{12.29.17.2.20.29.1.11.19.8.12, 11.14.21.24.10.7.29.23.24.28, 31.21.22.14.8.21, 31.18, 25.9.10} +{32.3.23.7.2, 5.27.21.1.29.29.28, 30.3.16.26.7.27.26.9.27.21.18, 22.28.20.6.32.32} +{5.19.1.26.20.6.20, 19.26.32.13.1.12.30.26.22.25, 21.8.9, 8.13.1, 15.26.24.31.16.15.17.22.8.30.3} +{14.14.25, 32.6.31.31, 29.1.7.26.25.11.22} +{24.17.24, 1.4.14.32.14, 14.21.22} +{22.17.4.2.22.17, 21.9.32.1.27} +{8.3.18.13.30.20.27.26.17.28, 25.21.8.17, 19.10.4.30.32.4.12} +{16.20.29.26, 21.18.30.19.24.24} +{32.15.20.28.5.1.23.4, 7.13.15, 9.16.2.16.22.24.17.31.14.21.17} +{23.28.1, 6.20.14, 26.9.20.12.22.22.32, 2.4.25.32.16.22.26.13.17.18} +{26.18, 12.10.11.9.10.31.4.16.31, 24.17.31.20.12.9.19.29.18, 4.22} +{28.15.18.27, 3.9.25.26.7, 2.1.12.19.29.28.3.31.28.28.10, 12.15.10.17.18.13, 29.32.13.4.1.16.20} +{8.17.9.15.21.28.1.7.1.3.6, 32.1.31, 23.17.25.4.1.16.29.10, 9.5} +{27.29.1.5.30.6.22.16.23.2.28, 20.30.17, 22.13.22.8.30.32.10.24} +{26.31.6.8.29.8.24, 7.19.10.12.31.1.27.13.19, 27.18.10.4.22} +{29.1, 24.15.15.17.22, 21.4.22.20.24.28.6} +{21.20.24.25.6.26.23, 29.32.13.4.1.16.20, 13.9.9.27.31.11.25.9.27.22.13} +{8.24.11.13.25.19, 29.1.2.14.14, 21.32.13.22.3.13.31.23.14.12.9, 2.10.28.1.17.19.32.28, 1.10.23.25.5.11} +{11.14.21.24.10.7.29.23.24.28, 3.13, 23.25.23.11.7.23} +{18.18.5.11.7.4.25, 7.31, 18.7.10.27.17.24, 19.2.9.29.6} +{15.6.19.3, 1.27.22.23.2.26.32.17.7.9} +{32.6.8, 23.12.19.25.16.23.22.6.29.4, 9.7.31.11.8.23, 28.4} +{1.29.18.1.21.12.13.27.32.15, 14.21.6.5.26.9.32.16.25, 30.25.8.24.6.29.31, 26.18.32.20, 17.5.3.15.17.13.5} +{1.3.15.11.11.25.24.21.19, 4.14.10.19.16, 32.3.23.7.2} +{28.5.13, 26.25.10.10.13} +{30.23.10.1.10.7.22.28.18.11.17, 32.16} +{8.17.9.15.21.28.1.7.1.3.6, 6.7.25.16.13.21.7.20.25.12.4, 26.28.14, 5.13.23.19.28.26.27.6.1.22, 32.1.21.1.16.29.21} +{6.26, 29.29.17.31, 4.11.19.17.2.22.20.18.13.32.15, 29.23.15.25.1.6.6.10} +{1.25.7.9.26.17.31.20.13, 23.3.32.21.5.14.10.17.1, 30.23.10.1.10.7.22.28.18.11.17, 23.5.7.12.11.23.10, 14.19.20.13.27.2.2} +{15.30.17.5.32.28.2.18.27, 29.1.7.26.25.11.22, 15.8.10, 15.8.3.15.27.14.29.28.6.5.25} +{19.30.27.26.21.7.18, 4.13, 16.5.14.21.32.17.23.3.4.26, 5.3.17.29} +{18.21, 21.9.27.22.32, 30.24.23.25.32.18.22.12.29.9.22, 5.9.19.6} +{30.18.30.16.29, 16.19.17.30.30.5.17.24.27, 15.7.5.12.7.9.3.28.26, 4.11.22.4.19.24.4.28.6.8.22, 25.24.29} +{24.16.27.10.9, 10.28.7.16.31, 24.12, 31.24.26.18} +{18.24.21.17.11.26.28.22.21.18.10, 10.29.26.4.27.17.11, 32.6.15.26.14.15.3.19, 15.28.24} +{8.14.19.18, 1.3.15.11.11.25.24.21.19} +{10.22.30.16.2.21.17.13, 30.5, 32.17.8.24.2.14.5.4.22, 1.10.5.22.13} +{32.1.21.1.16.29.21, 26.9.17.1.18.19.1.11.18.29.3, 32.1.31, 28.1.3, 14.21.6.5.26.9.32.16.25} +{25.29, 31.30.12.20} +{29.27, 30.3.16.26.7.27.26.9.27.21.18, 32.6.8, 24.28.32.21, 25.17.18.30} +{16.5.12.5.15.12.24.25.3, 23.22.10.1.14.24} +{26.25.24, 9.18.30.11.29.32.7.19.2, 8.16.30.29.19.22.28.24.2, 1.31.3} +{3.9.25.26.7, 21.5.11.18, 11.1.3.28.30.21.24.14, 23.32.5.25.19.9.15.17.15.11, 7.31.4.20.17} +{28.6, 21.20.24.25.6.26.23, 10.18.12.27.24.30.32.7.11.5.13} +{8.16, 2.2.18.18.3.3.18.8.10.8} +{27.27.30.11.15.24.9.7.4.30, 4.13} +{10.18.12.27.24.30.32.7.11.5.13, 4.22, 25.9, 26.8.28, 25.3} +{18.18.5.11.7.4.25, 19.26.32.13.1.12.30.26.22.25, 29.26.25.14.24.18.2.13.23.29} +{23.28.1, 23.20.12.16.15.2} +{20.32.5.1.3.20.3.30.27, 15.5.1.31.28.10.8, 24.23.24.4.15.25.17, 22.10.16.8, 27.31.2.16.29.6} +{17.8, 11.17.10, 19.16.31.31.29.12} +{19.3.23.4.4.21.23, 29.14.12.9.17.5.32, 27.27.30.11.15.24.9.7.4.30, 24.17.24} +{21.5.11.18, 23.28.1} +{2.8.13.12.17.23.16.7.11.23, 10.12.9.6.6.26.14.8.23.1.25, 9.17.13.31.7, 1.30.18.31.12.25.4.19.28.12.15, 15.29.25} +{15.7.3.14.23.19.26, 12.4.12.13.25.30.30.8.9.12} +{20.23.29.5.7.30.13.14.22, 23.12.1.5.32.25.8.24.1.25, 8.29.6.3, 22.19.20.5.2.20, 8.9.22} +{12.6.14.23.19.21.9.12, 21.7.7.11, 1.30.18.31.12.25.4.19.28.12.15} +{27.18, 14.6.10.29.25.26.20.24.24, 6.29.6.13.14.24.10.4.14.28} +{31.9.3.5, 18.29.13.24.18.3.12.18.12.12} +{5.4.8.25.12.27.2.29.28.3, 10.12.9.6.6.26.14.8.23.1.25, 32.24.11.8.12.23.22.19.11.17.18} +{27.15.15.15, 17.26.18, 1.10.21, 4.31} +{23.14.12.30.18.4.16.18.7.7, 8.17.9.15.21.28.1.7.1.3.6, 9.5} +{8.13.9.31.20.20.24.7.23.31.28, 17.29.21.10.18.8.16.26.18.21.26, 19.9.32.23.13.24.1} +{24.2.6.7.16.7.28, 32.6.8, 24.23.29.8.24.11.21.10.28.14.27} +{25.22.2.25.6, 32.19.20.24.23.31.8.32.16.29, 29.11.20.22.27, 14.4.23.4.23.22.11.6.26.5, 23.12.32.22.19.1.22.4} +{13.9.9.27.31.11.25.9.27.22.13, 13.16.4.28, 10.28.22.29.13.19.6.7.6.14, 28.15.25.7.13.6.19.2, 30.9.24} +{31.28.32.4.31.4.7, 28.15.18.27, 29.26.25.14.24.18.2.13.23.29} +{8.11.20, 13.32.15.32.26.14.32} +{13.16.1.27.18.18.19.6.14.4, 3.29.32.26.8.10.25, 4.27.32.18, 12.6.14.23.19.21.9.12} +{28.6.11.6.15.22.12.6, 6.1.8.6.30.29.30, 4.22.17.10.19.9.8.19.28.3.9, 6.14} +{5.8.17.30.15.8.19.29.30.11.6, 32.1.23.20.14.12.23.5.32.15, 2.10.10.4.20.1.12.13, 11.21.13.9.19, 12.23.3.19.29.15.12.6} +{10.31.25.31.24.16.17, 32.24.29.6, 19.22.21.13.27.13.15, 29.15.29.8.31.26.1, 2.16.3.7.22.18.29.20} +{6.19.3, 18.24.21.17.11.26.28.22.21.18.10, 11.1.3.28.30.21.24.14} +{1.19.22.11.14.7.32.23.19.14, 2.30.26.10.14.31.18.2} +{23.17.28.31.28, 5.15.16, 23.10.13.32.14.20.16.11.14} +{6.11.31.23.12.8.30.14.27, 4.15.20.23.12.16.2.16.17, 23.12.32.22.19.1.22.4} +{8.32.30.1, 17.22.12.10.30.11, 14.5.13.19.25.12.32.9.13.16.12} +{4.11.19.17.2.22.20.18.13.32.15, 8.27.3.4.12.26.16, 7.30.19.25.23.15.14.29} +{15.8.3.15.27.14.29.28.6.5.25, 30.31.13.9, 15.31.11.27.19.19.20.5.5} +{28.25.29.4.13.5.6, 21.7.7.11, 8.3.18.13.30.20.27.26.17.28, 12.15.10.17.18.13} +{24.1.10.20.28.18.6.27.20.30.26, 23.2.22.7.32.3.27.6} +{24.1.29.32.14.15.32.6.15.22, 28.5.12.9.2.27.11.11.2, 3.29.19.2.24, 28.23.2.30.3.8.1.15.15.14.13, 24.27.14} +{10.16.19.7.15, 31.9.3.5, 31.18.25.1.14.29.25.5.22.30} +{27.3.3.11.21.4.25, 4.31, 2.24.4.5.24.32, 30.24.23.25.32.18.22.12.29.9.22} +{30.25, 8.10, 5.23.31.18.24.32, 22.19.5.22.20.31.23.24.14.24.4} +{32.1.23.20.14.12.23.5.32.15, 31.18.25.1.14.29.25.5.22.30, 9.26.1.16, 24.23.24.4.15.25.17} +{16.8.29.7.21.2.3, 13.8.20.9.21, 22.19.5.22.20.31.23.24.14.24.4, 4.9} +{3.26, 2.32.8.28.24.20.9.24.25.8.9, 14.1.11, 19.31.14.25.5.8.21.11.13.20} +{8.27.3.4.12.26.16, 27.27.30.11.15.24.9.7.4.30, 2.30.26.10.14.31.18.2, 3.10} +{21.9.32.1.27, 5.15.10.3.23.13.32.23, 23.27.6.26.22, 30.25.8.24.6.29.31} +{32.1.24.29.22.5.9.24.18.3.13, 29.3.15.17.12.29, 5.15.16} +{1.10.5.22.13, 15.28.30.19.31.6.2.2.31, 28.14.24.26.6.15.16.32.25.13.8} +{14.2.14.11.12, 12.10.11.9.10.31.4.16.31, 1.18.29.30.22.14.3.20.15.21.20, 5.10.3.9.23.30.23, 26.8.28} +{6.22.12, 12.16.13} +{4.14, 11.3.15.28.22.8.14, 2.6.15.26.23.26.24, 11.17.17.24.11.23.17.17.18.10.22} +{9.30, 19.10.4.30.32.4.12, 21.28.17.22.10.27.4.20.2.32, 19.26.24.27.6.24.16.27.32.29, 26.14.5.32.10} +{20.3.1.8.8.30.20, 1.18.29.30.22.14.3.20.15.21.20, 1.18.29.30.22.14.3.20.15.21.20, 7.23.1.24.29.13.31.19.23.17.7, 31.7.14.2} +{14.2.14.11.12, 18.13.9.3.18.15.2, 28.11.11.30.20.11.32, 1.1.1.2} +{3.26.32, 25.9.1.5.9.11.25.4.11.27.32} +{12.17.10.7.17.16, 9.30, 4.30.8.20.19.9.30.24.11, 1.12.25.26.22.8.15.23, 12.11.20.20.29} +{30.20.3.2.5.15.8.7.17, 5.24.25.15.27.30.20, 9.28.24, 7.12.1.10.6.17.29.24.24.4} +{4.21.28.5.16.29.5.21, 32.6.9.26.16.4.4.29.7.11} +{6.18.1.4.18.23, 13.32.15.32.26.14.32, 10.5.23.5.32.9.18.5.30} +{27.17.3.18.2.13.18, 24.12, 6.11.11.5.16.8.14.12.9} +{6.11.31.23.12.8.30.14.27, 10.22.1, 28.6.8.22.25} +{7.30.19.25.23.15.14.29, 3.21.16.24.23.12.16.32.3, 4.25.12.10.15.9.18.9, 28.4} +{14.19.26.15.22.23, 24.21.14.25.11.3.20.6.6.16, 20.9.29.32.13.7.23, 12.4.12.13.25.30.30.8.9.12, 15.31.11.27.19.19.20.5.5} +{1.14.3.7.3.17.2.29, 29.26.25.14.24.18.2.13.23.29, 25.2.3.15.11.19.5.28.25.14} +{26.24, 22.10.16.8} +{12.29.17.2.20.29.1.11.19.8.12, 19.2.9.29.6, 14.5.13.19.25.12.32.9.13.16.12, 10.18.12.27.24.30.32.7.11.5.13, 31.4.7} +{22.30, 23.17.25.4.1.16.29.10, 4.26.5.26.21.28.17.24.25.23, 24.10.8.25.16} +{18.18.19.16.14.16.21.10.25, 4.10.28} +{22.19.21.11.6.8.29.24, 6.25.17.32, 17.13.19.31.12.18.10.15.14, 9.31.4.14.31.10.17.5.2, 9.9.13.9.14.27} +{26.18, 5.19.1.26.20.6.20, 23.5.7.12.11.23.10} +{22.17.7.30.13.24, 5.14.29.2.23.16.20.22, 4.5.9.4.15.19.8.26.17.26.3} +{24.9.15.1.14.29.6.4, 21.9.32.1.27} +{1.28.3.22, 19.9.32.23.13.24.1, 6.25.17.32, 15.28.30.19.31.6.2.2.31, 18.15.14} +{20.32.5.1.3.20.3.30.27, 1.13.16.27.11.16.30.2.9.18.4} +{15.29.32.16.29.12.20.32.13.20, 28.26.25.7, 12.29.26.18.4.21.28.8.13.3, 12.4.10.17.4.10.23.3, 15.1.8} +{14.21.6.5.26.9.32.16.25, 20.4.1.16.31.3, 17.11.17.4.8.26.26.20.6} +{1.1.1, 10.12.23.22.23.22.20.17.17.9} +{21.23.13, 9.5.9.3.23.9.25.14.1.29.28, 28.8.21.15.16.28.4.16.26.8, 25.15.11, 23.23} +{16.5.14.21.32.17.23.3.4.26, 24.9.15.1.14.29.6.4, 20.5.4.9.31.14.26.6} +{22.19.21.11.6.8.29.24, 4.11.19.17.2.22.20.18.13.32.15, 17.25.26.23.32, 27.3.3.11.21.4.25, 3.14.30.5.32.22.29} +{19.22.21.13.27.13.15, 19.17.13.12.32.16.3, 10.12.23.22.23.22.20.17.17.9, 7.19.6.17.15.26.21.9} +{2.13.9.28, 11.11.9.30.15.29.15.18, 20.14.11.2.10.14} +{1.1.7.32.11.22, 9.21.20.29.1, 32.31.11.22.1, 14.15.31.29} +{27.18, 27.26.29, 28.30.24.16.17.28.2.13.10} +{5.15.16, 30.17.2.25, 18.29.5.1.10.21.2, 15.3.31.9.27.14.9.8.14.6.32} +{9.28.24, 26.7.22.3.18.21.11} +{4.19.16.15.5.2.25.8.28.14.2, 9.31.4.14.31.10.17.5.2, 22.30} +{22.13.22.21.25.17.8, 31.13, 9.7.31.11.8.23} +{1.1.2.1, 6.11.31.23.12.8.30.14.27, 3.18, 24.27.14} +{30.8.9.14.25.30, 25.17.9.16.17.31.23.29.24, 29.26.25.14.24.18.2.13.23.29, 4.26.23.6.19.31.10.4.22, 23.27.27.16} +{11.19.23.3.6.11, 21.17.31.10.31.13.9.26.6.14} +{4.2.2.32.24.25.31.3, 8.1.29.18.22, 22.23.22.30, 15.1.8} +{20.29.18.16.2.21.23.11, 32.8.29.18.31, 28.25.29.4.13.5.6} +{32.30.18.17.1.14.12.18, 28.6.11.6.15.22.12.6, 9.30} +{3.27.18.8.4.21.6.32.30.7.5, 6.22.12, 12.11.17.1.2} +{26.14, 11.1.3.28.30.21.24.14} +{20.13, 29.30.7.31.22, 26.9.17.1.18.19.1.11.18.29.3, 15.9.11.20.22.15.11.13} +{6.2.32, 32.24.11.8.12.23.22.19.11.17.18, 23.20.12.16.15.2, 11.32.18.31} +{7.32.10.3.30.12.14, 27.4} +{32.3.23.7.2, 25.17.18.30} +{14.27.29.23.4.1.17.32.6.25.22, 11.7.31.15.22, 26.32.21.31.27.12} +{26.7.5.8.11.9.22.1.6, 7.27.20, 16.28, 1.18.29.30.22.14.3.20.15.21.20, 30.17.4.5.13.6} +{4.2.2.32.24.25.31.3, 2.1.12.19.29.28.3.31.28.28.10, 22.9.15.19.12, 19.6.13.14.22.13.9.29, 28.8.21.15.16.28.4.16.26.8} +{21.23.13, 11.17.17.24.11.23.17.17.18.10.22, 3.29.32.26.8.10.25, 31.18.25.1.14.29.25.5.22.30} +{1.1.1, 16.29.6.23.13.28.31.6.19.26.15, 9.5, 9.5, 25.19.27.2.9.20} +{8.13.9.31.20.20.24.7.23.31.28, 9.7.31.11.8.23, 6.11.11.5.16.8.14.12.9, 1.25.7.9.26.17.31.20.13, 11.2.27.3} +{31.28.32.4.31.4.7, 10.28.7.16.31} +{10.18.12.27.24.30.32.7.11.5.13, 3.3, 6.29.6.13.14.24.10.4.14.28, 1.9.18.10.1.26.22.16.17, 11.18.4.8.3.13.14.28.18.31} +{8.12.4, 10.31} +{20.30.28.15.17, 23.17.28.31.28} +{16.9.29, 31.9.3.5} +{30.12.28.2, 13.25.10.25.8.16} +{10.28.7.16.31, 23.8.13.22.21, 26.9.17.1.18.19.1.11.18.29.3} +{27.4, 24.27.18.32.14.9.11.28.9} +{13.14.13.10.28.26.9.18.27.21, 13.8.15.3.7.31.5.10.15.30, 31.18.32.11.7.25.20.5, 30.6.4, 24.27.18.32.14.9.11.28.9} +{25.2.11.20.8.6.22, 16.29.6.23.13.28.31.6.19.26.15, 5.10.3.9.23.30.23} +{32.25.3.6, 26.32.8.12.30.19.24.8.6.1.10, 11.32.18.31, 2.9} +{25.3, 32.6.15.26.14.15.3.19} +{11.16.16.28.14, 16.19.17.30.30.5.17.24.27} +{16.27.8.17.14.17.21.29.14, 12.18, 24.9, 12.16.2.4.15, 22.10.16.8} +{4.2.6.20.7.8, 25.24.2.32.14.18.16, 28.6.11.6.15.22.12.6, 4.22.17.10.19.9.8.19.28.3.9, 19.2.26.21.16.11.2.2} +{11.8.18, 22.8.20.1.10.28.6.27, 11.18.4.8.3.13.14.28.18.31, 27.15.15.15, 14.6.10.29.25.26.20.24.24} +{25.11.24, 25.6, 1.1.2} +{15.7.3.14.23.19.26, 7.19.6.17.15.26.21.9, 10.3.19} +{11.6.11.29.4.5.24.6.26.12, 6.29.6.13.14.24.10.4.14.28} +{26.32.21.31.27.12, 12.25.32.2.27.3.3.16, 11.10, 24.9.15.1.14.29.6.4} +{21.6.22.28.12.23.11.22, 27.11.15.9.24.31.18.4.1.30.20, 17.13.14.29.27.27.13.12.15, 21.14.13, 30.31.13.9} +{26.28.14, 9.21.20.29.1, 25.3, 9.14.27.31.26.21.25.3.20, 16.28} +{22.32.6.6.3.8.24.6.25.29, 12.18, 8.16, 15.10.30.1.4.12.8.20, 31.9.3.5} +{19.7.29.31.3.20.7.21.25.27.29, 20.29.18.16.2.21.23.11, 4.21.9.1.2.14.8.17.13.26} +{19.3.23.4.4.21.23, 20.5.4.9.31.14.26.6, 15.31.11.27.19.19.20.5.5, 7.26.18, 26.31.16.18.22.13.32.23.9.20} +{29.5.18.27.3.21.18.6.14, 12.27.30.12.24.2.20, 2.15.14.20.30.26, 21.14.13, 1.9.18.10.1.26.22.16.17} +{27.3.3.11.21.4.25, 3.18.18, 17.8, 8.13.9.31.20.20.24.7.23.31.28} +{21.14.13, 9.7.31.11.8.23, 14.13.9.13.11.5.5.2.2.32.12, 23.12.11.11.15.16.22.31.32.5.8} +{17.1.12.20, 21.31.31.25.5.30.26} +{22.10.27.19.29.20.29.3.12.14.25, 31.21.22.14.8.21} +{19.7, 9.17.13.31.7, 29.1.7.26.25.11.22, 8.16.1.16.28.6.3.22.6.23} +{23.20.8, 13.28.9.3, 3.29.19.2.24, 4.13.22.11.9.13.27.15.7, 9.8.23.2.20.16} +{12.16.13, 17.14.7.3.2.18.20.23.18.5, 13.3.20, 3.4.22.19} +{16.9.14.28.6.21.31.31.26, 20.4.1.16.31.3} +{1.1.3, 5.19.1.26.20.6.20, 18.31.32.29.22.1.31.11.28} +{24.32.17.23.24.19.23.9.20.18, 10.12.9.6.6.26.14.8.23.1.25, 26.25.24, 18.9.26.7, 3.9.11.23.32.26.24.28} +{32.27.13.6.7, 9.17.13.31.7, 29.27.13.29.10.2} +{31.29.18.26.1.26.17, 11.11.11.4.23.21.25, 25.28.30.24} +{23.22.10.1.14.24, 17.10.17.22.20.25.14.13, 7.14.22.29.30.14.25.1.9.26.25, 20.24.14.15.4.21.12.27.4.12, 30.16.3.21.10} +{16.19.17.30.30.5.17.24.27, 16.21.13.1.4, 7.30.5.10.10.5.30.14.9.18} +{10.28.22.29.13.19.6.7.6.14, 4.14.32, 24.2.6.7.16.7.28} +{16.14.3.17.17.26.12.19.19.30, 6.2.32, 32.28.1.32.28.10} +{28.17.26.9, 28.2.27.1.20, 16.31.12.27.25.9.32.29, 22.17.30, 2.24.5.3.4.10.27.26.17.28.16} +{18.31.32.28.1.4.24.24.12.25, 15.21.23.30.9.25, 22.20.30, 23.3.32.21.5.14.10.17.1} +{4.21.9.1.2.14.8.17.13.26, 11.32.18.31, 3.11.32.11.22.3.7.17.8.13.23} +{17.25.2.13.10.27.13.1, 30.25.8.24.6.29.31} +{12.13.16.17.29.27.16.14.9.19.9, 32.3.12.2} +{22.17.24.14.21.15.12.18.17.25.11, 18.19.12.20.18.17.15.32.18.5} +{21.17.18.32.7.8, 30.32} +{30.24.32.15.14.10.11, 2.15.18.21.5.21.4.7.30, 8.16.20.24.20.6.10.21, 29.1.7.26.25.11.22} +{2.19.4.1.15.7.8.9.17.29, 16.5, 4.30.8.20.19.9.30.24.11, 2.11.32.25.23, 7.23.15.32.28.27.2.2.26} +{11.22.28.8.12.23.25.15.21.28, 25.29, 23.5.5.17, 25.5.30.7.16.12.21.12.11.16, 18.30.11.17} +{26.31.6.8.29.8.24, 3.21.16.24.23.12.16.32.3, 32.3.5.9.17.15, 31.17, 23.19.17.31.29.13.1.12.5.25} +{12.13.5.31, 2.24.4.5.24.32, 31.5.6.4.8.29.3} +{23.10.13.32.14.20.16.11.14, 13.17.7, 19.12.20.24.32.13.11.23.26} +{1.13.16.27.11.16.30.2.9.18.4, 24.32.17.23.24.19.23.9.20.18} +{29.27.13.29.10.2, 20.17.18.21.1} +{19.31.14.25.5.8.21.11.13.20, 29.25.29.16.32.11.15.25.5.22.3} +{18.7.10.27.17.24, 23.10.5.26.12.4.20.4, 13.26.17.3.2.19, 17.10.17.22.20.25.14.13} +{15.17.2.32.7, 9.23.21.22.5.29.15.21, 29.1.2.14.14} +{30.32, 3.29.32.26.8.10.25, 10.29.26.4.27.17.11, 28.2.27.1.20, 31.17} +{28.6.8.22.25, 11.30.20.15.18.32.1.18.25.26.8, 27.4.15.14.19.6.12, 19.3.23.4.4.21.23, 30.15} +{8.26.29.13.7.25.31.28.3.32, 1.1.1} +{14.1.11, 4.26.5.26.21.28.17.24.25.23} +{30.9.24, 24.3.23.25, 4.26.5.26.21.28.17.24.25.23, 28.26.25.7} +{12.17.10.7.17.16, 19.15.26.19, 12.16.2.4.15} +{1.1.1.1, 4.26.23.6.19.31.10.4.22} +{2.32.10.13.12, 18.27.11.27.9.16.7.6.22.26.27, 22.11} +{17.8, 4.10.28} +{10.2.17.26.16.7.19.6.23.3, 14.10.11.30.5.7.6.24.9.30.26, 18.7.10.27.17.24, 10.26.27.23.4.31.11.25.29, 13.26.17.3.2.19} +{1.10.23.25.5.11, 18.24.21.17.11.26.28.22.21.18.10, 14.30.2.21.15.16.13} +{13.7, 22.9.15.19.12, 22.21.32.15.8.29.5.12.10.29, 32.1.24.29.22.5.9.24.18.3.13, 7.31.2.28.15.11.17.18.19.23.6} +{31.28.32.4.31.4.7, 9.5.9.3.23.9.25.14.1.29.28, 27.31.2.16.29.6, 31.30.23.7.7.24.32.10.11.1.31} +{20.14.11.2.10.14, 31.4.7, 22.24.22.25.15.23.13} +{13.3.20, 24.31, 24.9.15.1.14.29.6.4, 2.15.18.21.5.21.4.7.30} +{20.20.32.29.24.5.5.26.22.32, 20.18.24.14.12.13.9, 15.9.11.20.22.15.11.13, 21.7.23.9.16.5.18.14} +{4.14.32, 21.9.32.1.27, 9.21.28.8.12.15.3.13.10.11, 8.16.20.24.20.6.10.21, 6.9.1.10.10.22.6} +{7.11, 15.21.22} +{19.7.29.31.3.20.7.21.25.27.29, 7.12.23, 21.4.22.20.24.28.6, 30.25.24.22, 9.14.27.31.26.21.25.3.20} +{13.26.17.3.2.19, 27.4} +{11.7.31.15.22, 20.6.26.3.30, 27.32.26.21.31.17.32.32} +{2.22.19, 8.16.20.24.20.6.10.21, 4.10.28, 20.4.1.16.31.3, 28.14.32.29.2.3.4} +{6.17.10.10.7.9.27.8.29, 10.26.27.23.4.31.11.25.29} +{3.4.22.19, 15.31.11.27.19.19.20.5.5, 25.16.9.6, 14.6.10.29.25.26.20.24.24, 32.27.13.6.7} +{28.9.3.16.17.21.23.30, 13.3.20} +{8.25.20.3.15.24.7.4.24.5.30, 17.25.2.13.10.27.13.1, 29.10.12.17.12.16} +{22.16, 25.4.32, 28.15.25.7.13.6.19.2} +{3.1.13.22.24.14.12.31.3.4, 5.10.3.9.23.30.23, 28.2.27.1.20} +{26.16.12.3.27.9.28, 9.19.7.13.13.25, 9.18.23} +{23.20.24, 24.3.23.25, 22.15, 20.29.18.16.2.21.23.11} +{27.27.30.11.15.24.9.7.4.30, 10.31, 24.1.10.20.28.18.6.27.20.30.26, 3.29.19.2.24} +{20.30.28.15.17, 14.6.10.29.25.26.20.24.24, 12.10, 23.20.8} +{19.10.4.30.32.4.12, 28.6.8.22.25, 9.22.10.15.5.15} +{22.3.6, 12.4.24.6.1.13.5.20, 23.5.7.12.11.23.10, 20.23.7.11.11.31.18.16.3} +{24.2.26.24.14.15.31.23.17.26, 32.6.13.8.32, 22.17.4.2.22.17, 4.10.28, 17.1.12.20} +{1.27.22.23.2.26.32.17.7.9, 17.25.2.13.10.27.13.1, 2.12.30.22.12, 23.20.8, 27.27.25.10.31.10.21.22.21.16.12} +{24.27.18.32.14.9.11.28.9, 27.3.3.11.21.4.25, 8.13.6.12.18.7} +{26.19.3.14.8.28.31.10, 17.5.3.15.17.13.5, 23.25.23.11.7.23, 15.5.1.31.28.10.8, 19.9.32.23.13.24.1} +{12.25.32.2.27.3.3.16, 12.28.12.24.28.15.5.12.30.13.21, 10.8.20.11.12.23.22, 22.26.32} +{10.7.9, 32.29.24.31.25.6.9, 14.1.11, 13.24, 31.13} +{30.16.14.9.5.4.10.7.31, 21.28.24.23.3.11.7.12.22.32} +{6.19.3, 10.31.25.31.24.16.17} +{18.7.10.27.17.24, 22.17.30, 27.18, 14.24} +{23.17.25.4.1.16.29.10, 8.9.22, 10.5.23.5.32.9.18.5.30, 19.26.32.13.1.12.30.26.22.25} +{26.16.12.3.27.9.28, 23.24.16.32.13.29, 5.10.3.9.23.30.23, 21.10.20.9.3.16.9.10.20, 26.31.11.23.3} +{5.23.31.18.24.32, 31.4.7, 14.9.15.21.21.31.1.29} +{29.5.18.27.3.21.18.6.14, 2.2.18.18.3.3.18.8.10.8, 32.3.23.7.2} +{15.9.11.20.22.15.11.13, 5.27.32.21.5.1.11.14} +{1.1.2.1, 11.7.31.15.22, 22.26.1.28.9.9.31, 19.17.13.12.32.16.3, 25.18.8.3.23.23.5.9.6} +{1.26, 16.23.30.12.31.31.19.14, 14.19.26.15.22.23, 5.18.9.25.31.21.22} +{20.17.14.7, 9.5.9.3.23.9.25.14.1.29.28, 21.32.13.22.3.13.31.23.14.12.9, 19.10.4.30.32.4.12} +{23.12.1.5.32.25.8.24.1.25, 10.31.25.31.24.16.17} +{25.22.2.25.6, 6.29.6.13.14.24.10.4.14.28, 24.10.8.25.16} +{12.15.10.17.18.13, 27.29.1.5.30.6.22.16.23.2.28, 20.30.17, 29.1.2.14.14} +{15.25.31.11.4.22.16.7.11, 22.16, 7.14.22.29.30.14.25.1.9.26.25, 25.5.30.7.16.12.21.12.11.16} +{29.20.1.11.21.16.1.2.14.28, 32.1.24.29.22.5.9.24.18.3.13} +{2.28.5.17.6.32, 29.28.9.15.8.27.31} +{32.6.31.31, 13.1.6.17.28.9.15.30.1.27.14, 3.6.24.21.20.32.3.4.26.5} +{24.10.10.31.4.29.9, 28.26.4.22.13.20.32.27.15, 3.11.32.11.22.3.7.17.8.13.23, 15.21.22} +{19.26.24.27.6.24.16.27.32.29, 13.24, 17.3} +{12.4.24.6.1.13.5.20, 28.27.24.14, 14.19.20.13.27.2.2} +{9.26.1.16, 8.21.8.23.4.18, 15.29.32.16.29.12.20.32.13.20, 9.7.31.11.8.23} +{15.28.24, 3.5, 3.20.19.10.17.27.3.6.22.23, 4.13.22.11.9.13.27.15.7} +{25.16.9.6, 26.25.10.10.13, 11.11.9.30.15.29.15.18, 6.5.27.19.13.26.1.18.9, 16.2.14.3.26.11} +{23.19.17.31.29.13.1.12.5.25, 15.17} +{5.10, 5.10.3.9.23.30.23, 1.1.1} +{15.8.10, 23.5.5.17, 32.3.12.2, 5.27.21.1.29.29.28} +{17.13.8, 31.13, 16.18.23.6.31, 26.18} +{13.28.12.6, 21.6.22.28.12.23.11.22, 12.22.20.4.12} +{6.9.29.17.4.32, 15.17} +{29.15.29.8.31.26.1, 32.15.20.28.5.1.23.4} +{24.9.8.12.29, 15.5.1.31.28.10.8} +{15.17.2.32.7, 24.25.7.27.30.8.26.17, 24.16.27.10.9} +{18.19.12.20.18.17.15.32.18.5, 1.20.18.25.3.24.25.10.9, 4.14.17.12.20.17.1.22.3} +{17.29.21.10.18.8.16.26.18.21.26, 31.13, 14.26.25.4.12.26.8, 21.14.22.29, 17.8.31.32} +{24.27.18.32.14.9.11.28.9, 5.24.4.31.3.16.25.17.13.26.11, 10.29, 27.3.3.11.21.4.25, 5.13.23.19.28.26.27.6.1.22} +{4.7.1, 31.24.26.18, 12.25.32.2.27.3.3.16, 26.24, 5.2.32.19.13.29.12.13.31.29} +{29.20.1.11.21.16.1.2.14.28, 26.24, 1.9.18.10.1.26.22.16.17} +{5.23.31.18.24.32, 11.11.11.4.23.21.25, 11.2.27.3, 1.13.16.27.11.16.30.2.9.18.4} +{25.15.11, 3.10.4.5.28.11, 26.14.5.32.10, 29.27.7.7.3.11.14.26.21.11} +{9.8.23.2.20.16, 23.14.30.27.28.26.26.23.8.32, 22.19.5.22.20.31.23.24.14.24.4, 1.1.1.2.1} +{27.5.15.1.15.16.21, 32.6.3.2.12.5.28.1.25, 19.16.31.31.29.12, 19.12.30.2.21} +{23.22.10.1.14.24, 20.29.18.16.2.21.23.11, 10.27.7.24.26.11.31.20.29, 1.25.7.9.26.17.31.20.13} +{27.18, 15.4.15, 25.9.1.5.9.11.25.4.11.27.32, 12.29.17.2.20.29.1.11.19.8.12, 9.2.10.4} +{23.28.20.25.30.24.15, 27.3} +{15.26.24.31.16.15.17.22.8.30.3, 13.32.15.32.26.14.32, 14.17.7.30.8.25.26.4, 12.3} +{5.14.27.15.11.17.3.10.27.25, 24.27.18.32.14.9.11.28.9, 30.23.2.13.14.15.29.19.4.12.24} +{21.15.31.24.29.24.26.12.20, 8.24.11.13.25.19} +{24.9.27.16.20.21, 16.29.6.23.13.28.31.6.19.26.15, 3.15.2.23.22.2.16.14, 16.13.26.18.9.29.11.17.1.24.26} +{19.7.29.31.3.20.7.21.25.27.29, 28.11.27.21.14.16} +{5.2.32.19.13.29.12.13.31.29, 30.12.6.30, 9.21.20.29.1, 2.16.3.7.22.18.29.20} +{32.15.20.28.5.1.23.4, 11.1, 2.14.12.13} +{21.17.27.23.15, 19.26.24.27.6.24.16.27.32.29, 26.9.17.1.18.19.1.11.18.29.3} +{7.13, 30.25.17.17.10.29} +{24.27.14, 22.19.21.11.6.8.29.24, 2.19.4.1.15.7.8.9.17.29, 7.13.15, 4.22} +{17.5.3.15.17.13.5, 11.2.27.3, 1.1.3} +{17.24.15.27.3.32.4.22.20.6.24, 20.17.18.21.1, 19.22.29.32.1.21.26.24.23.17, 32.8.5, 5.27.21.1.29.29.28} +{10.27.7.24.26.11.31.20.29, 3.25} +{15.26.24.31.16.15.17.22.8.30.3, 20.8.19.14.16.7} +{20.22.10, 1.12.25.26.22.8.15.23} +{13.7, 23.32.5.25.19.9.15.17.15.11, 31.13, 6.10.25.12} +{11.17.17.24.11.23.17.17.18.10.22, 7.31, 24.13.1.8} +{16.14.3.17.17.26.12.19.19.30, 28.15.25.7.13.6.19.2, 26.24, 6.19.6.4.9.11.32.17.17.3.15} +{22.23.25.28.5.27.9.9.24.31.10, 1.27.22.23.2.26.32.17.7.9} +{32.25.3.6, 23.5.5.17} +{20.5.4.9.31.14.26.6, 6.29.32.13.30.3.16, 27.18} +{18.13.6.12.26.26.26.29.18.20.1, 18.13.9.3.18.15.2, 21.14.22.29} +{19.5.20.3.4.2.3, 4.10.28, 7.7} +{25.15.11, 14.23.31.5.5.15.17.12.17.7.3, 26.31.11.23.3, 25.32.24.24.28.15.16.10, 26.19.3.14.8.28.31.10} +{20.1.24.3.30.31, 13.3.8, 4.7.1, 3.21.16.24.23.12.16.32.3} +{7.14.22.29.30.14.25.1.9.26.25, 17.9.32.31.21.31.23.17.10.32.9} +{29.5.18.27.3.21.18.6.14, 27.3, 5.10, 21.14, 7.7} +{13.17.7, 13.3.8, 14.19.30.6.4.10.10.10.22.25.11, 13.7} +{30.17.25.3.31.11.3.4.1.10, 5.24.4.31.3.16.25.17.13.26.11, 27.11.14.17.24} +{16.5.10.2.18.8.15.12.32.25.10, 8.3.18.13.30.20.27.26.17.28, 5.27.16.3.30} +{29.29.18, 4.26.2.2} +{3.4.22.19, 16.19.17.30.30.5.17.24.27} +{12.4.26.23.25.5.15.7.16, 20.29.18.16.2.21.23.11, 22.10.18, 24.18.16} +{1.1.1.1, 2.12.30.22.12, 1.22.29.5.16, 8.12.4} +{32.31.11.22.1, 2.8.13.12.17.23.16.7.11.23, 32.15.20.28.5.1.23.4, 4.31, 6.26} +{19.11.29.13.15.27.12.15.14.12, 30.30.17.5.30.21.19.5.22.22.14, 16.5.14.21.32.17.23.3.4.26} +{3.6.24.21.20.32.3.4.26.5, 20.4.1.16.31.3, 5.31.8.1.5.13.21.28.29.19.2, 23.8.13.22.21} +{20.4.27.31.1, 27.18.10.4.22} +{4.2.6.20.7.8, 27.27, 26.32.8.12.30.19.24.8.6.1.10, 4.22.17.10.19.9.8.19.28.3.9} +{23.24.11.31.10.31.18.28.13.18.6, 3.21.6.13.12.18.25} +{27.25, 5.19.1.26.20.6.20} +{11.21.16.27.16, 29.3.15.17.12.29} +{27.3, 28.14.32.29.2.3.4, 29.27.13.29.10.2, 10.16.18.9.27.2.29.32.24.13} +{31.7.14.2, 12.28.12.24.28.15.5.12.30.13.21, 27.1.11.3.25.9.6.6, 25.9.10} +{28.6.8.22.25, 26.32.21.31.27.12} +{29.3.17.17.18.32, 11.21.13.9.19, 20.8.19.14.16.7, 3.27.18.8.4.21.6.32.30.7.5, 14.2.14.11.12} +{12.7.28.26.14.21.18.31.5.15.11, 16.13.19.11.18.13.17.17, 16.31.12.27.25.9.32.29, 17.7.26.30.18.23.4} +{22.17.24.14.21.15.12.18.17.25.11, 20.30.17, 10.2.17.26.16.7.19.6.23.3, 30.4.30.11.13.23.14.24.11} +{2.1.12.19.29.28.3.31.28.28.10, 14.1.15.25.27.23.25.26.28.10, 14.15.31.29} +{1, 25.24.2.32.14.18.16, 25.18.8.3.23.23.5.9.6, 29.27.13.29.10.2, 12.16.13} +{19.16.31.31.29.12, 2.13.9.28} +{32.1.31, 19.19.25.22.11.6.15.3.2.19, 4.22.17.10.19.9.8.19.28.3.9, 25.6, 21.23.13} +{32.3.5.9.17.15, 16.28} +{32.15.20.28.5.1.23.4, 27.6.13.24.21.27.28.22.3.7.4, 24.32.27, 22.9.15.19.12} +{18.9.21.2.31.8.32, 27.22.11.13.21.25.5.1.27.21.27, 11.30} +{25.5.30.7.16.12.21.12.11.16, 18.4, 19.17.13.12.32.16.3} +{15.10.30.1.4.12.8.20, 1.1.1} +{28.31.10.28.22.26.16.15, 28.5.12.9.2.27.11.11.2, 12.10, 24.24, 22.24.22.25.15.23.13} +{28.2.27.1.20, 24.18.16} +{13.32.15.32.26.14.32, 22.23.22.30, 10.12.23.22.23.22.20.17.17.9, 9.22.10.15.5.15} +{31.24.26.18, 11.12.6.21, 20.24.14.15.4.21.12.27.4.12, 27.2.10.4.25.14.2.15.4} +{4.14, 28.2.27.1.20} +{10.32.14, 25.6.12.16.1, 4.18.29.9.16.10, 25.17.18.17.27} +{17.26.18, 14.21.5.28.3.32.24.14.25.31, 16.5.23.17, 12.16.2.4.15, 6.20.14} +{29.14.31.25.7.32.23, 1.1.2, 29.27, 4.31} +{24.24, 1.18.29.30.22.14.3.20.15.21.20, 12.7.28.26.14.21.18.31.5.15.11, 11.12.6.21, 14.6.10.29.25.26.20.24.24} +{7.19.6.17.15.26.21.9, 7.23.1.24.29.13.31.19.23.17.7, 2.6.15.26.23.26.24, 30.25.8.24.6.29.31} +{2.22.19, 15.11.26.1.30.6.23.5, 10.22.30.16.2.21.17.13, 30.20.3.2.5.15.8.7.17, 7.31.4.20.17} +{10.27.7.24.26.11.31.20.29, 8.2.18.23.5.16.17.1} +{5.27.21.1.29.29.28, 1.30.31.31.20.16.7} +{23.22.10.1.14.24, 8.1.29.18.22} +{21.7.23.9.16.5.18.14, 18.7.10.27.17.24, 25.9, 10.18.12.27.24.30.32.7.11.5.13} +{7.30.5.10.10.5.30.14.9.18, 31.17, 7.12, 28.25.11.22} +{27.11.15.9.24.31.18.4.1.30.20, 8.2.18.23.5.16.17.1} +{24.31.8, 9.28.10.26.14.26.15.14, 25.30.1.4.24.11, 6.21.30.7, 28.23.2.30.3.8.1.15.15.14.13} +{6.14, 25.10.29.3.6.21.3.31.13, 12.14.20.8.28.4} +{6.19.6.4.9.11.32.17.17.3.15, 4.13, 9.8.23.2.20.16, 24.12, 16.24.3.30.15.22.31.2} +{7.21.8, 24.12, 18.4.14.29.3, 32.3.23.7.2, 19.30.27.26.21.7.18} +{25.10.4.28.3.31.19, 28.9.3.16.17.21.23.30, 28.2.27.1.20, 1.15.17.6.28.25.24.31.27.9} +{16.21.13.1.4, 15.26.24.31.16.15.17.22.8.30.3, 20.20.7, 4.22.7.19.25} +{5.9.19.6, 12.6.14.23.19.21.9.12, 23.28.1, 3.3, 2.4.25.32.16.22.26.13.17.18} +{25.4.32, 10.11.25.2.24.18.18.21.6.26.21, 8.21.8.23.4.18, 10.22.1} +{7.13, 9.10.19.18.15.11.22.32.32.14.9, 2.1.3.30.24.17.9, 4.11.22.4.19.24.4.28.6.8.22} +{14.13.9.13.11.5.5.2.2.32.12, 12.1.28.22.25, 23.20.12.16.15.2, 28.28, 19.9.32.23.13.24.1} +{1.20.22.26.2.6.11, 2.11.32.25.23, 22.9.15.19.12, 9.3.3, 21.28.17.22.10.27.4.20.2.32} +{7.7.22.24.17.32.17.25.28, 2.27.15.14, 6.29.32.13.30.3.16, 30.24.32.15.14.10.11} +{1.15.17.6.28.25.24.31.27.9, 24.11.5, 15.10.30.1.4.12.8.20, 8.17.9.15.21.28.1.7.1.3.6} +{27.4.15.14.19.6.12, 24.9.15.1.14.29.6.4, 8.9.25.25.26.30.31.31.2.32.7, 15.9.8.20.27} +{26.14, 12.10} +{15.11.26.1.30.6.23.5, 26.5.29.7.28, 7.19.10.12.31.1.27.13.19, 28.6.8.22.25, 3.18.18} +{29.11.20.22.27, 25.4.4.1.13.32.26.20.20.3, 5.8, 26.8.28} +{3.22.18.1.5.14.9.6.14, 28.25.10.25.19.15, 25.17.9.16.17.31.23.29.24} +{20.8.19.14.16.7, 15.23.26.20.27.7} +{9.28.24, 15.28.24, 19.26.24.27.6.24.16.27.32.29, 30.12.28.2, 5.10.2.11.21.9.19} +{13.28.12.6, 28.25.11.22, 28.20.8.9.9.28.30.29, 22.18.20.23.15.9.12} +{15.23.26.20.27.7, 29.14.31.25.7.32.23, 14.29, 3.27.18.8.4.21.6.32.30.7.5, 22.12.22.28} +{16.13.26.18.9.29.11.17.1.24.26, 17.19.1.22.11.7.22.1.14.28.11} +{14.17.7.30.8.25.26.4, 15.17, 8.13.9.31.20.20.24.7.23.31.28} +{28.2.27.1.20, 21.17.27.23.15, 2.13.9.28, 25.31} +{29.1.7.26.25.11.22, 11.7.31.15.22, 3.18.18, 3.15.2.23.22.2.16.14} +{21.7.7.11, 13.3.20, 3.22.18.1.5.14.9.6.14, 31.18.32.11.7.25.20.5} +{5.4.8.25.12.27.2.29.28.3, 19.12.20.24.32.13.11.23.26} +{18.13.6.12.26.26.26.29.18.20.1, 9.19.7.13.13.25, 4.19.16.15.5.2.25.8.28.14.2} +{23.8.13.22.21, 23.5.7.12.11.23.10, 4.26.23.6.19.31.10.4.22, 4.7.1} +{31.9.3.5, 26.11, 16.9.32.14.3.7.8.7.21.22, 16.20.29.26, 6.25.17.32} +{17.25.26.23.32, 6.11.31.23.12.8.30.14.27} +{1.21.28.4.23, 30.30.17.5.30.21.19.5.22.22.14, 9.26.1.16, 27.27.25.10.31.10.21.22.21.16.12, 8.9.22} +{19.17.13.12.32.16.3, 5.14.29.2.23.16.20.22, 13.12, 21.18.2.1} +{18.15.14, 6.9.29.17.4.32, 8.3.3.25.25.15.7.13.21.18, 32.8.5} +{18.29.5.1.10.21.2, 7.19.6.17.15.26.21.9} +{15.21.23.30.9.25, 4.26.5.26.21.28.17.24.25.23} +{16.29.6.23.13.28.31.6.19.26.15, 31.29.4.29.24.30.30.32.10.23, 17.27, 2.15.18.21.5.21.4.7.30} +{28.26.25.7, 15.5.1.31.28.10.8, 17.17.14.28.6.30} +{30.32, 32.30.18.17.1.14.12.18, 9.30} +{9.26.1.16, 18.21} +{25.28.3, 22.23.25.28.5.27.9.9.24.31.10, 4.15.20.23.12.16.2.16.17, 29.5.18.27.3.21.18.6.14, 28.14.32.29.2.3.4} +{27.11.14.17.24, 24.17.31.20.12.9.19.29.18, 23.28.3.30.15.31.32.3.21.9.19} +{6.10.25.12, 4.14.32, 1.10.21, 29.1.2.14.14} +{32.6.8, 13.25.10.25.8.16} +{18.19.11.20.13.13.11, 3.10.27.4.5.6.19.12.28.12, 11.30} +{21.5.17.19.15.25.18.21.24.9, 30.12.9.25.24.6.7.24.29, 17.14.7.3.2.18.20.23.18.5} +{8.6.6.5.8.8.12, 16.5.23.17, 3.13, 9.31.4.14.31.10.17.5.2, 9.3.3} +{25.4.32, 23.10.13.32.14.20.16.11.14, 10.22.30.16.2.21.17.13, 21.6.22.28.12.23.11.22} +{6.13.31.5.7.26, 12.11.17.1.2, 23.2.22.7.32.3.27.6, 17.24.30.6.32, 5.31.8.1.5.13.21.28.29.19.2} +{26.12.27.2, 6.17.10.10.7.9.27.8.29, 30.24.23.25.32.18.22.12.29.9.22, 29.3.17.17.18.32} +{19.10.26.19.5.21.30.23, 25.17.9.16.17.31.23.29.24, 6.9.29.17.4.32, 24.13.1.8} +{23.20.24, 32.6.13.8.32, 2.22.19, 8.3.18.13.30.20.27.26.17.28} +{20.1.24.3.30.31, 23.28.20.25.30.24.15, 27.4.17.17.32.8.16.15.17.13, 8.32.30.1} +{6.18.1.4.18.23, 31.21.22.14.8.21, 10.18.12.27.24.30.32.7.11.5.13} +{19.2.26.21.16.11.2.2, 25.10, 3.19.11.6.5} +{17.22.12.10.30.11, 12.3, 6.25.17.32, 15.28.24} +{15.10.30.1.4.12.8.20, 19.3.23.4.4.21.23} +{6.1.8.6.30.29.30, 27.16, 27.5.15.1.15.16.21, 7.7.22.24.17.32.17.25.28} +{4.27.32.18, 10.5.23.5.32.9.18.5.30, 17.10.17.22.20.25.14.13} +{12.27.23.32.1.1.9.29.13, 1.1.2.1, 28.20.8.9.9.28.30.29} +{19.26.32.13.1.12.30.26.22.25, 8.1.29.18.22, 21.20.28.19.27.9} +{5.10.2.11.21.9.19, 16.5.14.21.32.17.23.3.4.26, 11.10.22.18, 1.20.18.25.3.24.25.10.9, 8.32.30.1} +{9.16.2.16.22.24.17.31.14.21.17, 7.21.8, 21.4.11.18, 22.25.4.28.9.20.12.13, 28.11.27.21.14.16} +{10.32.14, 24.13.1.8, 18.4} +{18.19.11.20.13.13.11, 22.28.20.6.32.32, 20.9.29.32.13.7.23, 13.3.8} +{28.11.27.21.14.16, 4.16.22.19.24.21, 4.2.16.13.16.11.19.10.10.25, 23.27.6.26.22} +{23.14.30.27.28.26.26.23.8.32, 9.10.32, 8.21.17.3.6.3.18} +{8.29.6.3, 14.6.10.29.25.26.20.24.24, 7.19.6.17.15.26.21.9, 17.5.3.15.17.13.5, 6.1.8.6.30.29.30} +{6.9.1.10.10.22.6, 32.3.23.7.2, 1.1.1.1} +{15.11.26.1.30.6.23.5, 30.25.17.17.10.29} +{30.27.8.6.11.19, 8.12.4, 31.17.2.30.11, 27.29.1.5.30.6.22.16.23.2.28} +{6.25.17.32, 24.27.18.32.14.9.11.28.9, 30.22.29.21.19.14.3.2.6, 21.31.31.25.5.30.26, 9.21.14.19} +{21.14.25.20.13.31.14.20, 11.32.18.31, 31.29.18.26.1.26.17} +{2.4.25.32.16.22.26.13.17.18, 8.10, 28.8.21.15.16.28.4.16.26.8} +{21.23.17.8.23.11.8.1, 16.28, 28.9.3.16.17.21.23.30} +{8.9.25.25.26.30.31.31.2.32.7, 24.1.29.32.14.15.32.6.15.22} +{27.17.17.19.24.9.14.20, 13.19.2.6.23.19.9.7.21.8.16} +{30.31.13.9, 13.8.20.9.21} +{3.15.2.23.22.2.16.14, 18.9.21.2.31.8.32, 16.8.29.7.21.2.3, 23.24.11.31.10.31.18.28.13.18.6, 10.31} +{29.1, 32.27.18.7.3.4.2} +{1.1.7.32.11.22, 10.11.25.2.24.18.18.21.6.26.21, 19.10.26.19.5.21.30.23} +{11.2.27.3, 3.3, 24.9, 21.28.24.23.3.11.7.12.22.32, 23.3.20.24} +{22.22.27.6.27.15.5.18.21.28.9, 19.7} +{21.14.22.29, 12.21.20.20, 3.9.25.26.7, 24.13.1.8} +{12.7.16.8.21.22.2.16.18, 14.19.20.13.27.2.2, 32.1.23.20.14.12.23.5.32.15, 7.19.10.12.31.1.27.13.19} +{4.15.20.23.12.16.2.16.17, 6.8.7.20.2, 4.18.29.9.16.10} +{1.27.22.23.2.26.32.17.7.9, 22.19.21.11.6.8.29.24} +{24.28.32.21, 22.16.25.18.25.7.24.29.14.8, 4.3.6.27.22.23.10} +{9.2.4.27.26, 1.20.22.26.2.6.11, 26.19.3.14.8.28.31.10, 13.17.7} +{30.25.24.22, 14.1.11} +{4.14.32, 4.3.20.27.9.1.18.30.12.5.19, 3.14.1.14.17.28.29.16, 31.4.7, 8.25.20.3.15.24.7.4.24.5.30} +{6.11.31.23.12.8.30.14.27, 15.23.26.20.27.7, 22.8.20.1.10.28.6.27, 29.5.32.20.11.7.13.24.17, 10.31.25.31.24.16.17} +{13.25.10.25.8.16, 22.17.9.11.25.15.3.9, 11.11.11.4.23.21.25, 14.8.15.30.7.29.27.31.4, 6.5.27.19.13.26.1.18.9} +{29.3.15.17.12.29, 6.17.26.25.27.11.10.9, 18.13.9.3.18.15.2, 24.15.15.17.22, 20.6.26.3.30} +{1, 24.3.23.25, 4.25.12.10.15.9.18.9, 21.9.27.22.32} +{19.7.29.31.3.20.7.21.25.27.29, 13.25.10.25.8.16, 4.1.24.24.28.24.18} +{26.31.16.18.22.13.32.23.9.20, 14.11.25, 13.26.17.3.2.19, 7.10.17.21.11.29.17.25.19.4.29, 29.14.31.25.7.32.23} +{13.30.24, 8.11.20, 29.23.15.25.1.6.6.10, 4.9} +{22.10.16.8, 19.3.23.4.4.21.23, 30.16.3.21.10, 30.32, 23.10.13.32.14.20.16.11.14} +{8.11.20, 21.17.31.10.31.13.9.26.6.14, 21.20.28.19.27.9, 12.7.16.8.21.22.2.16.18, 1.22.29.5.16} +{6.5.27.19.13.26.1.18.9, 1.1.1.2.1, 26.28.14} +{29.25.29.16.32.11.15.25.5.22.3, 26.26.22.21.14.11.29.19.14.24, 12.4.12.13.25.30.30.8.9.12, 24.1.29.32.14.15.32.6.15.22, 3.4.22.19} +{18.30.11.17, 17.7.26.30.18.23.4, 23.17.25.4.1.16.29.10, 24.23.24.4.15.25.17} +{21.15.18.18.30.3.20, 28.25.29.4.13.5.6} +{14.19.26.15.22.23, 3.21.16.24.23.12.16.32.3} +{26.5.29.7.28, 32.6.15.26.14.15.3.19, 26.17.9.13.4.25.32.2.24.9} +{2.27.15.14, 8.16.6, 30.9.24, 30.23.10.1.10.7.22.28.18.11.17, 24.24} +{32.1.23.20.14.12.23.5.32.15, 28.30.24.16.17.28.2.13.10} +{24.11.5, 10.20, 13.17.7, 27.24.11.31.21.6.29.17.24.18, 28.26.25.7} +{4.7.1, 11.10.22.18, 23.27.27.16, 31.18.25.1.14.29.25.5.22.30} +{26.9.17.1.18.19.1.11.18.29.3, 1.10.21, 1.30.31.31.20.16.7} +{29.30.7.31.22, 6.27.29.14.8.12.26.3.21.4.1} +{1.20.18.25.3.24.25.10.9, 3.19.11.6.5} +{18.31.32.28.1.4.24.24.12.25, 22.29.29.11} +{24.9, 32.27.18.7.3.4.2, 28.5.12.9.2.27.11.11.2, 26.18.32.20, 25.29} +{8.13.1, 8.9.21.16.29, 13.19.2.6.23.19.9.7.21.8.16, 29.1} +{18.18.5.11.7.4.25, 6.19.6.4.9.11.32.17.17.3.15, 30.27.8.6.11.19} +{30.16.3.21.10, 12.14.20.8.28.4, 13.8.20.9.21, 30.31.13.9, 17.7.26.30.18.23.4} +{29.3.15.17.12.29, 27.17.15.7.28.20, 30.23.10.1.10.7.22.28.18.11.17} +{14.4.19.27.28.24.19, 18.7.10.27.17.24, 4.3.6.27.22.23.10, 31.5.6.4.8.29.3, 22.10.12.23.9} +{22.13.22.21.25.17.8, 2.9, 30.2.17.8.14, 32.1.23.20.14.12.23.5.32.15, 22.15} +{14.23.31.5.5.15.17.12.17.7.3, 23.6.27} +{1.1.2, 7.16.20.17, 25.10, 22.23.18.18.9.8.23.7.23.23.16, 1.18.29.30.22.14.3.20.15.21.20} +{5.14.29.2.23.16.20.22, 3.21.16.24.23.12.16.32.3, 3.9.11.23.32.26.24.28, 9.30} +{20.1.24.3.30.31, 5.13.23.19.28.26.27.6.1.22, 5.24.24.9.32.26.31, 26.13.4.7.13.11.3} +{10.28.7.16.31, 6.29.6.13.14.24.10.4.14.28} +{11.19.23.3.6.11, 13.14.13.10.28.26.9.18.27.21, 5.14.27.15.11.17.3.10.27.25, 11.22.28.8.12.23.25.15.21.28, 26.32.21.31.27.12} +{22.17.24.14.21.15.12.18.17.25.11, 19.5.20.3.4.2.3, 3.29.19.2.24} +{7.5.28.8.17.26.31.10.15, 16.13.19.11.18.13.17.17} +{11.6.11.29.4.5.24.6.26.12, 5.21.27.13.14.11.2.16.20, 25.32.24.24.28.15.16.10, 21.5.11.18, 17.8.31.32} +{7.27.20, 11.30, 8.16.6, 8.24.11.13.25.19, 9.16.2.16.22.24.17.31.14.21.17} +{12.24.29.32.32.29.2, 24.23.29.8.24.11.21.10.28.14.27, 1.10.5.22.13, 31.17.2.30.11} +{21.7.7.11, 20.28.22.7.10.28.27.22.14.16, 6.11.31.23.12.8.30.14.27, 12.29.17.2.20.29.1.11.19.8.12, 19.6.13.14.22.13.9.29} +{21.18, 26.14.5.32.10, 32.28.1.32.28.10, 27.4.15.14.19.6.12} +{28.11.27.21.14.16, 21.9.27.22.32, 6.8.7.20.2} +{26.24.9.12.11.15.31.2, 28.5.12.9.2.27.11.11.2} +{8.16.1.16.28.6.3.22.6.23, 11.3.15.28.22.8.14, 18.30.18.31, 8.16.1.16.28.6.3.22.6.23} +{11.19.23.3.6.11, 21.14, 27.22.11.13.21.25.5.1.27.21.27, 7.13.15, 26.9.17.1.18.19.1.11.18.29.3} +{27.2.10.4.25.14.2.15.4, 19.16.26.2} +{4.14.10.19.16, 20.23.29.5.7.30.13.14.22, 30.25.8.24.6.29.31} +{15.31.11.27.19.19.20.5.5, 23.3.32.21.5.14.10.17.1, 20.25.22.19.22, 7.19.10.12.31.1.27.13.19, 20.4.1.16.31.3} +{8.9.22, 8.13.1, 19.11.29.13.15.27.12.15.14.12} +{26.16.12, 11.21.13.9.19, 20.6.26.3.30, 11.1} +{32.8.29.18.31, 3.18} +{6.26.29.10.21.28.20.19, 32.3.5.9.17.15, 31.29.4.29.24.30.30.32.10.23, 20.22.10, 29.3.17.17.18.32} +{8.14.19.18, 13.3.8} +{2.15.14.20.30.26, 30.17.2.25, 22.23.22.30, 10.26.30.15.1, 8.3.18.13.30.20.27.26.17.28} +{21.31.31.25.5.30.26, 31.28.32.4.31.4.7, 26.17.9.13.4.25.32.2.24.9} +{5.4.8.25.12.27.2.29.28.3, 25.9.1.5.9.11.25.4.11.27.32, 17.24.30.6.32, 8.5.24.9.29.32.31.30.13.9.7, 29.27.7.7.3.11.14.26.21.11} +{14.5.13.19.25.12.32.9.13.16.12, 27.6.13.24.21.27.28.22.3.7.4, 30.23.2.13.14.15.29.19.4.12.24, 27.4.15.14.19.6.12, 15.29.32.16.29.12.20.32.13.20} +{10.8.20.11.12.23.22, 11.12.6.21} +{14.19.30.6.4.10.10.10.22.25.11, 20.18.24.14.12.13.9, 2.13.9.28, 19.30.27.26.21.7.18} +{1.26, 9.16.2.16.22.24.17.31.14.21.17, 1.1.1.2.1} +{15.1.8, 4.3.6.27.22.23.10} +{14.11.25, 24.10.10.31.4.29.9, 7.12.23, 21.17.27.23.15} +{1.12.25.26.22.8.15.23, 28.11.27.21.14.16, 32.17.8.24.2.14.5.4.22} +{11.6.11.29.4.5.24.6.26.12, 11.15.11.19.29.10, 22.21.32.15.8.29.5.12.10.29, 31.28.32.4.31.4.7} +{22.19.20.5.2.20, 22.26.1.28.9.9.31, 20.32.5.1.3.20.3.30.27} +{19.17.13.12.32.16.3, 3.9.11.23.32.26.24.28} +{20.20.7, 17.19.1.22.11.7.22.1.14.28.11, 5.12.2.20.1.24.25, 12.13.16.17.29.27.16.14.9.19.9, 31.18.32.11.7.25.20.5} diff --git a/contrib/ltree/data/ltree.data b/contrib/ltree/data/ltree.data new file mode 100644 index 0000000..246443e --- /dev/null +++ b/contrib/ltree/data/ltree.data @@ -0,0 +1,1006 @@ + +1 +1.1 +1.1.1 +1.1.1.1 +1.1.1.2 +1.1.1.2.1 +1.1.2 +1.1.2.1 +1.1.3 +22.19.21.11.6.8.29.24 +26.17.9.13.4.25.32.2.24.9 +10.22.30.16.2.21.17.13 +32.24.11.8.12.23.22.19.11.17.18 +14.30.23.3 +30.18.30.16.29 +11.10.22.18 +31.18.27.15.20.29.29 +13.25.10.25.8.16 +31.24.26.18 +2.4.25.32.16.22.26.13.17.18 +17.25.10.13.21.5.7.22.2 +25.15.11 +12.29.26.18.4.21.28.8.13.3 +23.12.19.25.16.23.22.6.29.4 +28.17.26.9 +5.10.3.9.23.30.23 +24.15.15.17.22 +7.30.5.10.10.5.30.14.9.18 +27.5.22 +26.16.12 +15.28.30.19.31.6.2.2.31 +19.16.26.2 +21.15.18.18.30.3.20 +10.29.26.4.27.17.11 +15.1.6.31.30.13.32.9.10 +30.8.9.14.25.30 +11.17.10 +4.31 +4.14.16.14.1.8.1.22.17.10 +13.17.7 +6.7.7 +31.4.7 +1.14.3.7.3.17.2.29 +11.1 +10.15.16.3 +11.8.18 +22.18.20.23.15.9.12 +18.19.11.20.13.13.11 +22.19.5.22.20.31.23.24.14.24.4 +7.12.1.10.6.17.29.24.24.4 +7.19.6.17.15.26.21.9 +21.14.22.29 +3.15.2.23.22.2.16.14 +25.17.9.16.17.31.23.29.24 +23.22.10.1.14.24 +26.28.14 +27.32.26.21.31.17.32.32 +7.7.25.22.22.26 +30.31.13.9 +29.27 +23.32.5.25.19.9.15.17.15.11 +5.15.16 +10.31.25.31.24.16.17 +7.31.2.28.15.11.17.18.19.23.6 +24.1.10.20.28.18.6.27.20.30.26 +15.8.10 +4.2.16.13.16.11.19.10.10.25 +25.7.3.21.31.12.28 +30.17.25.3.31.11.3.4.1.10 +30.17.2.25 +30.20.3.2.5.15.8.7.17 +25.2.11.20.8.6.22 +19.17.13.12.32.16.3 +27.27.30.11.15.24.9.7.4.30 +13.32.15.32.26.14.32 +6.19.6.4.9.11.32.17.17.3.15 +5.19.1.26.20.6.20 +6.6.22.8 +20.17.14.7 +2.15.18.21.5.21.4.7.30 +9.2.4.27.26 +20.13 +15.29.25 +29.23.15.25.1.6.6.10 +24.24 +19.26.24.27.6.24.16.27.32.29 +12.21.20.20 +1.18.29.30.22.14.3.20.15.21.20 +23.19.17.31.29.13.1.12.5.25 +4.13 +7.23.15.32.28.27.2.2.26 +26.7.22.3.18.21.11 +25.2.3.15.11.19.5.28.25.14 +26.32.8.12.30.19.24.8.6.1.10 +10.13.12.8.4.8.11.30 +8.21.8.23.4.18 +22.21.32.15.8.29.5.12.10.29 +12.4.26.23.25.5.15.7.16 +27.12.4.2.29.22.15 +24.31.2.13.5.23.18.16 +29.32.13.4.1.16.20 +5.18.9.25.31.21.22 +27.22.11.13.21.25.5.1.27.21.27 +29.27.13.29.10.2 +27.11.15.9.24.31.18.4.1.30.20 +17.11.17.4.8.26.26.20.6 +24.2.26.24.14.15.31.23.17.26 +17.22.12.10.30.11 +21.9.27.22.32 +22.16.25.18.25.7.24.29.14.8 +15.3.31.9.27.14.9.8.14.6.32 +11.19.23.3.6.11 +30.32 +23.5.5.17 +20.20.32.29.24.5.5.26.22.32 +22.10.27.19.29.20.29.3.12.14.25 +4.13.22.11.9.13.27.15.7 +30.24.23.25.32.18.22.12.29.9.22 +14.4.19.27.28.24.19 +6.11.31.23.12.8.30.14.27 +18.13.9.3.18.15.2 +1.27.22.23.2.26.32.17.7.9 +15.29.32.16.29.12.20.32.13.20 +13.16.1.27.18.18.19.6.14.4 +32.1.24.29.22.5.9.24.18.3.13 +26.24 +25.5.30.7.16.12.21.12.11.16 +25.4.32 +4.7.1 +26.14 +19.10.26.19.5.21.30.23 +10.13.22.1.8.30.9.24.1.2.1 +14.23.31.5.5.15.17.12.17.7.3 +8.25.20.3.15.24.7.4.24.5.30 +6.17.26.25.27.11.10.9 +5.27.16.3.30 +1.21.28.4.23 +22.10.16.8 +16.5.14.21.32.17.23.3.4.26 +5.21.27.13.14.11.2.16.20 +18.29.13.24.18.3.12.18.12.12 +21.1.4.9.9.31.24.21.3.29 +5.23.31.18.24.32 +14.8.15.30.7.29.27.31.4 +23.8.13.22.21 +8.2.18.23.5.16.17.1 +23.14.12.30.18.4.16.18.7.7 +17.25.2.13.10.27.13.1 +8.9.25.25.26.30.31.31.2.32.7 +30.5 +22.17.30 +6.22.12 +31.18.32.11.7.25.20.5 +28.5.12.9.2.27.11.11.2 +12.3 +17.5.3.15.17.13.5 +18.9.21.2.31.8.32 +23.17.22.1.23.4.29.32.4.1 +13.28.14.2.8.18 +16.18.23.6.31 +24.16.27.10.9 +12.15.10.17.18.13 +28.15.18.27 +21.7.23.9.16.5.18.14 +1.10.5.22.13 +18.30.18.31 +23.24.16.32.13.29 +11.10 +18.7.10.27.17.24 +9.9.13.9.14.27 +30.25 +11.11.9.30.15.29.15.18 +10.22.1 +12.1.1 +29.27.5.22.26 +23.27.27.16 +20.32.5.1.3.20.3.30.27 +6.9.29.17.4.32 +7.13.15 +2.32.8.28.24.20.9.24.25.8.9 +23.1.23.18.12.29 +28.18.6.22.13.8.25 +27.30.12.11.20.15.11.13 +7.12 +18.31.26.18.6.15.18.11 +12.28.12.24.28.15.5.12.30.13.21 +10.16.18.9.27.2.29.32.24.13 +9.10.19.18.15.11.22.32.32.14.9 +23.22.23.14.31.32 +6.26 +2.10.10.4.20.1.12.13 +18.9.26.7 +1.26.15.23.5.31.29.11.19.28.1 +19.7.29.31.3.20.7.21.25.27.29 +8.14.19.18 +23.17.25.4.1.16.29.10 +2.16.3.7.22.18.29.20 +32.27.18.7.3.4.2 +12.2.4.28.21.30.24 +5.13.23.19.28.26.27.6.1.22 +23.17.32.15.23.16.25 +9.31.23.19.5.10.16.4.30.24.5 +10.28.7.16.31 +8.22.32.17.16.28.31.23.22.9 +20.15 +20.20.7 +8.16 +25.6.12.16.1 +14.10.11.30.5.7.6.24.9.30.26 +9.17.13.31.7 +27.19.20.1.31.29.5.22.26.3 +32.3.12.2 +24.27.18.32.14.9.11.28.9 +16.30.10.7.29.4.9.21.22.13.26 +3.1.14.8.9.16.30.22.20 +23.6.27 +12.4.12.13.25.30.30.8.9.12 +32.6.9.26.16.4.4.29.7.11 +21.22.31.24.27 +21.18 +24.31.8 +2.8.13.12.17.23.16.7.11.23 +5.8 +26.31.11.23.3 +5.14.29.2.23.16.20.22 +5.12.2.20.1.24.25 +28.8.21.15.16.28.4.16.26.8 +31.7.14.2 +21.4.11.18 +4.3.6.27.22.23.10 +12.10 +1.29.18.1.21.12.13.27.32.15 +29.28.9.15.8.27.31 +12.24.29.32.32.29.2 +20.18.24.14.12.13.9 +32.25.16 +26.7.5.8.11.9.22.1.6 +19.3.12.12 +14.16.6.29.26.13.14.16.25.26.8 +11.22.28.8.12.23.25.15.21.28 +25.30.1.4.24.11 +5.8.17.30.15.8.19.29.30.11.6 +22.24.22.25.15.23.13 +1.9.18.10.1.26.22.16.17 +5.5.12.31.23.13.17.22.20 +25.32.24.24.28.15.16.10 +3.14.30.5.32.22.29 +4.30.8.20.19.9.30.24.11 +27.4.15.14.19.6.12 +15.31.11.27.19.19.20.5.5 +19.10.8.10.4.19 +16.24.3.30.15.22.31.2 +12.7.28.26.14.21.18.31.5.15.11 +22.17.4.2.22.17 +14.11.25 +7.12.23 +6.14 +22.23.25.28.5.27.9.9.24.31.10 +19.19.25.22.11.6.15.3.2.19 +28.26.26.6.31 +32.3.23.7.2 +2.10.28.1.17.19.32.28 +24.27.14 +9.30 +17.13.19.31.12.18.10.15.14 +17.7.26.30.18.23.4 +32.30.18.17.1.14.12.18 +10.5.5.15.29.2 +25.28.3 +21.5.11.18 +18.31.32.28.1.4.24.24.12.25 +32.6.3.2.12.5.28.1.25 +19.22.29.32.1.21.26.24.23.17 +29.3.15.17.12.29 +5.24.25.15.27.30.20 +24.25.7.27.30.8.26.17 +11.12.6.21 +9.2.10.4 +5.1.5.31 +23.20.12.16.15.2 +7.11 +14.12.31 +2.22.19 +18.7.3.17.13.5.31.6.31.25.29 +17.1.12.20 +21.23.17.8.23.11.8.1 +27.15.15.15 +2.9 +30.23.10.1.10.7.22.28.18.11.17 +19.15.26.19 +31.21.22.14.8.21 +16.13.26.18.9.29.11.17.1.24.26 +24.10.8.25.16 +22.17.7.30.13.24 +16.16.28.24.11 +24.28.32.21 +14.27.29.23.4.1.17.32.6.25.22 +3.14.11.15.21.32.2.15.13 +23.14.30.27.28.26.26.23.8.32 +10.7.9 +23.23 +29.30.7.31.22 +21.4.22.20.24.28.6 +31.28.32.4.31.4.7 +17.13.14.29.27.27.13.12.15 +25.9.10 +21.23.13 +22.29.18.32.13.12.22.31.17.22 +16.28 +7.5.28.8.17.26.31.10.15 +1.10.21 +8.16.6 +12.1.28.22.25 +30.30.17.5.30.21.19.5.22.22.14 +7.13 +11.7.31.15.22 +22.26.32 +20.32.9 +18.30.11.17 +15.6.19.3 +25.3 +20.6.3.26.7.29.28.4 +4.27.32.18 +16.5.10.2.18.8.15.12.32.25.10 +8.6.6.5.8.8.12 +18.29.5.1.10.21.2 +4.16.22.19.24.21 +27.23.2.32.11.21 +16.5.12.5.15.12.24.25.3 +9.18.23 +7.31.4.20.17 +13.28.12.6 +5.31.8.1.5.13.21.28.29.19.2 +5.27.32.21.5.1.11.14 +27.25 +18.27.11.27.9.16.7.6.22.26.27 +10.32.14 +29.26.25.14.24.18.2.13.23.29 +27.2.10.4.25.14.2.15.4 +1.15.17.6.28.25.24.31.27.9 +9.3.3 +3.19.11.6.5 +8.11.20 +14.2.14.11.12 +12.16.2.4.15 +26.11 +1.25.7.9.26.17.31.20.13 +9.28.10.26.14.26.15.14 +27.4.17.17.32.8.16.15.17.13 +11.3.15.28.22.8.14 +26.13.4.7.13.11.3 +16.8.29.7.21.2.3 +25.21.8.17 +11.11.11.4.23.21.25 +20.24.14.15.4.21.12.27.4.12 +30.2.17.8.14 +3.29.32.26.8.10.25 +12.18 +7.31 +13.30.24 +11.32.18.31 +30.12.28.2 +1.8 +28.6.11.6.15.22.12.6 +7.10.17.21.11.29.17.25.19.4.29 +6.7.25.16.13.21.7.20.25.12.4 +22.17.9.11.25.15.3.9 +18.24.21.17.11.26.28.22.21.18.10 +19.3.23.4.4.21.23 +3.10.27.4.5.6.19.12.28.12 +20.4.1.16.31.3 +1.22.19.24.8.11 +8.17.9.15.21.28.1.7.1.3.6 +25.4.4.1.13.32.26.20.20.3 +6.29.6.13.14.24.10.4.14.28 +29.27.13.9.28.29.19.13.29.31.27 +10.26.30.15.1 +22.26.1.28.9.9.31 +29.23.1.21.31.8 +3.4.22.19 +24.28.13.26.8.8.31 +9.19.7.13.13.25 +28.4 +19.30.18.11.32.14 +17.27 +31.13 +7.26.18 +14.24 +30.17.4.5.13.6 +18.13.6.12.26.26.26.29.18.20.1 +5.10 +2.13.9.28 +25.19.27.2.9.20 +24.1.29.32.14.15.32.6.15.22 +32.6.13.8.32 +18.17.6.16.6.10 +26.25.24 +30.12.9.25.24.6.7.24.29 +19.17.12.15 +6.20.14 +9.6.9.21.6.11.29.13.29.20.32 +29.1.7.26.25.11.22 +3.13 +22.9.15.19.12 +12.29.17.2.20.29.1.11.19.8.12 +32.31.11.22.1 +28.26.4.22.13.20.32.27.15 +18.19.12.20.18.17.15.32.18.5 +22.10.18 +1.16.8.18.14.16.21.25.6 +14.14.25 +9.28.30.1.6.25.17.9 +31.32.12.26.31.32.14.23.28 +6.19.29.11.2.32.21.15.32.9 +24.9.27.16.20.21 +13.24 +16.31.12.27.25.9.32.29 +23.3.20.24 +13.8.20.9.21 +21.6.22.28.12.23.11.22 +9.5 +12.4.24.6.1.13.5.20 +30.9.24 +32.15.20.28.5.1.23.4 +15.9.8.20.27 +3.20.19.10.17.27.3.6.22.23 +16.9.32.14.3.7.8.7.21.22 +7.32.10.3.30.12.14 +8.13.9.31.20.20.24.7.23.31.28 +10.11.25.2.24.18.18.21.6.26.21 +8.1.29.18.22 +17.9.32.31.21.31.23.17.10.32.9 +29.29.17.31 +31.29.18.26.1.26.17 +11.14.21.24.10.7.29.23.24.28 +14.17.7.30.8.25.26.4 +22.15 +4.10.28 +10.12.9.6.6.26.14.8.23.1.25 +23.12.1.5.32.25.8.24.1.25 +7.30.19.25.23.15.14.29 +10.31 +6.26.29.10.21.28.20.19 +29.25.30.15.21.3.25.26.26 +14.19.30.6.4.10.10.10.22.25.11 +28.27.24.14 +6.8.7.20.2 +12.13.5.31 +22.30 +3.9.25.26.7 +20.28.22.7.10.28.27.22.14.16 +13.19.2.6.23.19.9.7.21.8.16 +20.30.28.15.17 +7.19.10.12.31.1.27.13.19 +23.10.5.26.12.4.20.4 +31.5.6.4.8.29.3 +17.13.8 +2.2.18.18.3.3.18.8.10.8 +12.21.15.27.24.15.8.24.24.26 +25.24.2.32.14.18.16 +10.16.19.7.15 +15.7.3.14.23.19.26 +22.22.27.6.27.15.5.18.21.28.9 +4.21.28.5.16.29.5.21 +22.31.2.32.32.11.26.23.19 +19.20.25.7.27.28.27.17.9.3.1 +15.11.26.1.30.6.23.5 +16.20.29.26 +21.18.2.1 +5.9.19.6 +4.22 +11.30.20.15.18.32.1.18.25.26.8 +7.7 +8.10 +24.32.27 +21.21.10.27 +1.12.25.26.22.8.15.23 +15.17.2.32.7 +8.27.3.4.12.26.16 +29.14.31.25.7.32.23 +1.30.18.31.12.25.4.19.28.12.15 +22.13.22.21.25.17.8 +20.23.29.5.7.30.13.14.22 +23.2.22.7.32.3.27.6 +30.15 +14.4.23.4.23.22.11.6.26.5 +15.10.30.1.4.12.8.20 +32.19.20.24.23.31.8.32.16.29 +20.31.13.12.19.2.26.16.16.22.28 +21.20.24.25.6.26.23 +7.14.22.29.30.14.25.1.9.26.25 +6.9.1.10.10.22.6 +22.13.22.8.30.32.10.24 +11.18.4.8.3.13.14.28.18.31 +9.28.24 +21.15.31.24.29.24.26.12.20 +25.22.2.25.6 +19.12.30.2.21 +21.7.7.11 +29.11.20.22.27 +5.15.10.3.23.13.32.23 +21.18.30.19.24.24 +31.9.3.5 +4.2.6.20.7.8 +8.16.1.16.28.6.3.22.6.23 +2.19.4.1.15.7.8.9.17.29 +3.20.16.13.29.20 +32.16 +6.25.17.32 +3.22.18.1.5.14.9.6.14 +24.23.24.4.15.25.17 +32.8.29.18.31 +17.14.7.3.2.18.20.23.18.5 +9.3.31.18.12.3.9.29.10 +15.28.24 +22.11 +29.27.7.7.3.11.14.26.21.11 +9.7.31.11.8.23 +23.3.32.21.5.14.10.17.1 +29.9.25.27.15.16.32.26.6.32 +12.25.32.2.27.3.3.16 +1.1.7.32.11.22 +27.24.11.31.21.6.29.17.24.18 +16.5.23.17 +4.15.20.23.12.16.2.16.17 +3.1.13.22.24.14.12.31.3.4 +16.23.30.12.31.31.19.14 +22.23.18.18.9.8.23.7.23.23.16 +3.25 +32.27.13.6.7 +22.31.21.13.13.26.11.5.19 +14.19.20.13.27.2.2 +7.16.20.17 +6.20 +15.9.11.20.22.15.11.13 +2.14.10.4.17.17.8.4.27.20 +26.31.6.8.29.8.24 +10.18.12.27.24.30.32.7.11.5.13 +26.9.20.12.22.22.32 +9.18.30.11.29.32.7.19.2 +24.13.1.8 +2.24.4.5.24.32 +25.18.8.3.23.23.5.9.6 +17.8.31.32 +2.12.30.22.12 +22.10.12.23.9 +20.23.7.11.11.31.18.16.3 +8.17.25.26.15.25 +4.5.9.4.15.19.8.26.17.26.3 +27.6.13.24.21.27.28.22.3.7.4 +24.3.23.25 +30.12.6.30 +19.2.26.21.16.11.2.2 +1.31.3 +4.2.2.32.24.25.31.3 +18.21 +23.17.28.31.28 +18.4 +15.30.17.5.32.28.2.18.27 +28.1.3 +28.11.11.30.20.11.32 +32.3.5.9.17.15 +4.14.32 +29.25.29.16.32.11.15.25.5.22.3 +3.18 +21.32.13.21 +14.1.11 +26.12.27.2 +1.20.18.25.3.24.25.10.9 +26.19.3.14.8.28.31.10 +25.11.24 +15.23.26.20.27.7 +24.9.8.12.29 +19.10.4.30.32.4.12 +14.21.6.5.26.9.32.16.25 +1.26 +31.17 +2.28.5.17.6.32 +27.23.20.30.7 +19.22.21.13.27.13.15 +26.24.9.12.11.15.31.2 +31.18 +22.12.22.28 +32.2.11 +22.23.22.30 +29.3.17.17.18.32 +22.25.4.28.9.20.12.13 +20.17.18.21.1 +21.8.9 +6.1.8.6.30.29.30 +23.10.13.32.14.20.16.11.14 +20.22.10 +31.30.23.7.7.24.32.10.11.1.31 +26.16.12.3.27.9.28 +6.27.26.1.20.24.6 +3.14.1.14.17.28.29.16 +5.27.28.26.14.15.6.20.1.31.13 +20.30.9.9.14.12.29 +10.29 +12.27.23.32.1.1.9.29.13 +25.10.29.3.6.21.3.31.13 +17.8 +12.11.20.20.29 +16.21.13.1.4 +20.29.18.16.2.21.23.11 +19.16.31.31.29.12 +20.4.27.31.1 +32.6.8 +30.3.16.26.7.27.26.9.27.21.18 +6.2.32 +18.5.6.31.5.15.15 +18.4.14.29.3 +23.25.23.11.7.23 +17.19.1.22.11.7.22.1.14.28.11 +20.14.11.2.10.14 +27.21.28.24.7.2.24.23.8 +22.30.31.24.23.22.5.20.28.1 +28.28 +29.20.1.11.21.16.1.2.14.28 +6.17.10.10.7.9.27.8.29 +19.12.20.24.32.13.11.23.26 +6.21.30.7 +12.17.10.7.17.16 +32.1.21.1.16.29.21 +9.26.1.16 +8.16.30.29.19.22.28.24.2 +16.19.17.30.30.5.17.24.27 +21.14 +15.17 +8.29.6.3 +30.25.17.17.10.29 +10.28.22.29.13.19.6.7.6.14 +12.11.17.1.2 +26.31.7 +28.30.24.16.17.28.2.13.10 +18.18.19.16.14.16.21.10.25 +14.1.15.25.27.23.25.26.28.10 +14.15.31.29 +24.12 +30.27.8.6.11.19 +32.17.8.24.2.14.5.4.22 +16.5 +28.23.2.30.3.8.1.15.15.14.13 +15.5.1.31.28.10.8 +9.31.4.14.31.10.17.5.2 +17.24.30.6.32 +17.29.21.10.18.8.16.26.18.21.26 +2.31.25 +22.20.30 +2.14.12.13 +14.30.13.5.26.9.22.23.14.10 +25.17.18.30 +30.4.30.11.13.23.14.24.11 +29.30.21.8.16.23.32 +6.10.25.12 +22.32.6.6.3.8.24.6.25.29 +16.24.7.25 +16.13.2.19.14.29.31.30.23.15.12 +22.3.6 +19.31.14.25.5.8.21.11.13.20 +32.29.24.31.25.6.9 +19.30.27.26.21.7.18 +16.9.14.28.6.21.31.31.26 +32.4.19 +13.26.17.3.2.19 +1.22.29.5.16 +10.5.23.5.32.9.18.5.30 +7.27.20 +31.21.14.20.1.22.2.5.3.27.12 +14.19.26.15.22.23 +11.21.13.9.19 +14.9.15.21.21.31.1.29 +6.19.3 +31.30.12.20 +23.27.6.26.22 +17.10.17.22.20.25.14.13 +3.5 +21.17.18.32.7.8 +27.3 +29.29.18 +27.27.25.10.31.10.21.22.21.16.12 +26.32.21.31.27.12 +20.6.26.3.30 +16.9.29 +10.20 +5.2.32.19.13.29.12.13.31.29 +8.24.11.13.25.19 +12.13.16.17.29.27.16.14.9.19.9 +12.7.16.8.21.22.2.16.18 +10.26.27.23.4.31.11.25.29 +23.28.3.30.15.31.32.3.21.9.19 +8.12.4 +26.18.32.20 +16.29.6.23.13.28.31.6.19.26.15 +29.14.12.9.17.5.32 +28.26.25.7 +24.31 +32.6.15.26.14.15.3.19 +27.1.11.3.25.9.6.6 +27.18 +32.25.3.6 +21.5.17.19.15.25.18.21.24.9 +7.23.1.24.29.13.31.19.23.17.7 +13.28.9.3 +5.14.27.15.11.17.3.10.27.25 +10.27.7.24.26.11.31.20.29 +30.23.2.13.14.15.29.19.4.12.24 +26.9.17.1.18.19.1.11.18.29.3 +4.25.12.10.15.9.18.9 +14.21.5.28.3.32.24.14.25.31 +27.27 +15.7.5.12.7.9.3.28.26 +13.16.4.28 +21.9.32.1.27 +25.6 +23.12.11.11.15.16.22.31.32.5.8 +29.10.12.17.12.16 +8.9.21.16.29 +12.6.14.23.19.21.9.12 +14.6.10.29.25.26.20.24.24 +29.5.18.27.3.21.18.6.14 +4.1.24.24.28.24.18 +9.5.9.3.23.9.25.14.1.29.28 +25.10 +21.10.20.9.3.16.9.10.20 +20.8.19.14.16.7 +21.28.17.22.10.27.4.20.2.32 +1.28.19.8.25.6.20.27.29.27 +12.23.3.19.29.15.12.6 +27.17.17.19.24.9.14.20 +3.29.19.2.24 +19.9.32.23.13.24.1 +27.3.3.11.21.4.25 +25.16.9.6 +4.14.17.12.20.17.1.22.3 +19.7 +28.15.25.7.13.6.19.2 +1.28.3.22 +13.14.13.10.28.26.9.18.27.21 +26.25.10.10.13 +27.26.29 +6.27.29.14.8.12.26.3.21.4.1 +4.14.10.19.16 +5.4.8.25.12.27.2.29.28.3 +8.21.17.3.6.3.18 +3.6.24.21.20.32.3.4.26.5 +27.17.15.7.28.20 +21.17.27.23.15 +11.29 +26.18 +27.5.15.1.15.16.21 +21.28.24.23.3.11.7.12.22.32 +3.26 +31.29.4.29.24.30.30.32.10.23 +24.9.15.1.14.29.6.4 +13.8.23.13.11.18.24.21.11.24.10 +31.17.2.30.11 +8.5.24.9.29.32.31.30.13.9.7 +21.14.13 +3.21.6.13.12.18.25 +2.13.9.23.21.2 +22.17.24.14.21.15.12.18.17.25.11 +25.28.30.24 +24.2.6.7.16.7.28 +22.28.20.6.32.32 +1.13.16.27.11.16.30.2.9.18.4 +11.17.17.24.11.23.17.17.18.10.22 +22.16 +4.22.17.10.19.9.8.19.28.3.9 +12.27.30.12.24.2.20 +23.20.24 +28.6.8.22.25 +16.2.14.3.26.11 +15.4.15 +19.11.29.13.15.27.12.15.14.12 +28.20.8.9.9.28.30.29 +30.16.3.21.10 +11.1.3.28.30.21.24.14 +32.31.26.19.13.29.4.25 +8.13.6.12.18.7 +9.21.28.8.12.15.3.13.10.11 +4.19.16.15.5.2.25.8.28.14.2 +28.25.29.4.13.5.6 +25.24.29 +1.19.22.11.14.7.32.23.19.14 +22.22.10.30.5.15.25.21.19.11 +21.30.19.6.28.1.32.2.14.14 +26.5.29.7.28 +1.4.14.32.14 +19.2.9.29.6 +6.13.31.5.7.26 +27.11.14.17.24 +15.1.8 +11.15.11.19.29.10 +10.3.19 +5.3.29.9.22 +5.20 +13.9.9.27.31.11.25.9.27.22.13 +10.2.17.26.16.7.19.6.23.3 +30.8.18.5.20.6.15 +32.1.23.20.14.12.23.5.32.15 +3.9.11.23.32.26.24.28 +4.26.23.6.19.31.10.4.22 +1.10.23.25.5.11 +4.26.2.2 +14.30.2.21.15.16.13 +11.6.11.29.4.5.24.6.26.12 +19.26.32.13.1.12.30.26.22.25 +30.25.24.22 +6.11.11.5.16.8.14.12.9 +2.24.5.3.4.10.27.26.17.28.16 +3.18.8.22.7.28.32.31.3 +25.9 +12.14.20.8.28.4 +3.21.16.24.23.12.16.32.3 +8.3.18.13.30.20.27.26.17.28 +3.3 +8.32.30.1 +26.14.5.32.10 +24.20.23 +8.16.20.24.20.6.10.21 +23.12.32.22.19.1.22.4 +24.21.14.25.11.3.20.6.6.16 +12.4.10.17.4.10.23.3 +19.6.24.32.30.13.6.25.8.28 +1.3.15.11.11.25.24.21.19 +3.11.18.21.5.20.30 +9.23.21.22.5.29.15.21 +17.24.15.27.3.32.4.22.20.6.24 +23.24.11.31.10.31.18.28.13.18.6 +4.21.9.1.2.14.8.17.13.26 +23.28.20.25.30.24.15 +4.9 +8.13.14.11.11.29.22.4.4.10 +3.10.4.5.28.11 +29.10.17.11.28.12.18.5.19.15.21 +22.19.20.5.2.20 +19.6.13.14.22.13.9.29 +1.10.4.18.22.23.24 +28.11.27.21.14.16 +1.11.10.19.6.1.26.17.2.22 +24.17.31.20.12.9.19.29.18 +24.17.24 +19.5.20.3.4.2.3 +18.31.32.29.22.1.31.11.28 +15.21.22 +10.8.20.11.12.23.22 +9.8.23.2.20.16 +21.32.13.22.3.13.31.23.14.12.9 +4.22.7.19.25 +1.30.31.31.20.16.7 +22.29.29.11 +20.30.17 +30.24.32.15.14.10.11 +30.25.8.24.6.29.31 +9.21.14.19 +21.31.31.25.5.30.26 +20.25.22.19.22 +25.17.2.20.20.3.29.21.3.12 +29.6.12.31.20.23.32.20 +2.30.26.10.14.31.18.2 +28.6 +20.5.4.9.31.14.26.6 +20.1.24.3.30.31 +13.3.8 +25.29 +2.15.14.20.30.26 +5.24.4.31.3.16.25.17.13.26.11 +29.5.32.20.11.7.13.24.17 +24.9 +17.17.14.28.6.30 +4.11.22.4.19.24.4.28.6.8.22 +11.2.27.3 +28.25.10.25.19.15 +14.26.25.4.12.26.8 +3.10 +4.14 +28.31.10.28.22.26.16.15 +28.2.27.1.20 +32.8.5 +21.17.31.10.31.13.9.26.6.14 +13.7 +9.14.27.31.26.21.25.3.20 +17.29.31.8.24.10.18.27.17 +2.1.3.30.24.17.9 +18.15.14 +6.29.32.13.30.3.16 +27.17.3.18.2.13.18 +5.27.21.1.29.29.28 +13.3.20 +14.21.22 +4.18.29.9.16.10 +29.1.2.14.14 +8.13.1 +2.32.10.13.12 +9.10.32 +15.8.3.15.27.14.29.28.6.5.25 +12.22.20.4.12 +14.13.9.13.11.5.5.2.2.32.12 +9.21.20.29.1 +28.14.32.29.2.3.4 +28.9.3.16.17.21.23.30 +24.32.17.23.24.19.23.9.20.18 +15.26.24.31.16.15.17.22.8.30.3 +6.5.27.19.13.26.1.18.9 +2.6.15.26.23.26.24 +4.26.5.26.21.28.17.24.25.23 +25.14.5.32.25 +3.27.18.8.4.21.6.32.30.7.5 +2.11.32.25.23 +8.9.22 +18.18.5.11.7.4.25 +14.3.17.1.14.15.21.4.26 +10.3 +13.12 +27.31.2.16.29.6 +8.2 +27.18.10.4.22 +16.14.3.17.17.26.12.19.19.30 +20.9.29.32.13.7.23 +8.3.3.25.25.15.7.13.21.18 +4.16.7.25.21.7 +17.25.26.23.32 +20.3.1.8.8.30.20 +31.18.25.1.14.29.25.5.22.30 +21.20.28.19.27.9 +30.16.14.9.5.4.10.7.31 +30.22.29.21.19.14.3.2.6 +8.5.30.29.9.31 +23.28.1 +11.16.16.28.14 +18.6.26.2.13.9.6.11.10.11.16 +11.30 +16.5.6.12 +32.24.29.6 +8.31.22.27 +6.18.1.4.18.23 +28.5.13 +26.26.22.21.14.11.29.19.14.24 +29.1 +24.10.10.31.4.29.9 +19.11.10.18.14.13.7.7 +27.29.1.5.30.6.22.16.23.2.28 +3.11.32.11.22.3.7.17.8.13.23 +2.12.14.28.16.21 +24.23.29.8.24.11.21.10.28.14.27 +27.4 +4.11.19.17.2.22.20.18.13.32.15 +7.21.8 +2.27.15.14 +25.9.1.5.9.11.25.4.11.27.32 +25.31 +9.16.2.16.22.24.17.31.14.21.17 +32.1.31 +9.22.10.15.5.15 +12.10.11.9.10.31.4.16.31 +30.24 +15.25.31.11.4.22.16.7.11 +22.8.20.1.10.28.6.27 +10.12.23.22.23.22.20.17.17.9 +3.18.18 +7.7.22.24.17.32.17.25.28 +31.13.9.1.5.12 +25.17.18.17.27 +32.6.31.31 +26.8.28 +14.29 +30.6.4 +27.16 +24.18.16 +27.21.27.5.13.30.17 +23.20.8 +28.14.24.26.6.15.16.32.25.13.8 +13.1.6.17.28.9.15.30.1.27.14 +5.3.17.29 +13.8.15.3.7.31.5.10.15.30 +19.12.26.24.29.3 +11.21.16.27.16 +23.5.7.12.11.23.10 +29.15.29.8.31.26.1 +4.3.20.27.9.1.18.30.12.5.19 +7.19.12.3.21.19.18.5.2.14.10 +8.26.29.13.7.25.31.28.3.32 +12.16.13 +28.25.11.22 +17.26.18 +18.6.2.2.24 +24.11.5 +17.3 +21.14.25.20.13.31.14.20 +23.31.27.16.8.30.20.27 +3.32.2.29.3.32.28.11.29.30 +5.10.2.11.21.9.19 +16.27.8.17.14.17.21.29.14 +25.10.4.28.3.31.19 +16.13.19.11.18.13.17.17 +3.26.32 +5.13.23.4.9 +26.31.16.18.22.13.32.23.9.20 +32.28.1.32.28.10 +15.21.23.30.9.25 +1.20.22.26.2.6.11 +2.1.12.19.29.28.3.31.28.28.10 +14.5.13.19.25.12.32.9.13.16.12 +5.24.24.9.32.26.31 diff --git a/contrib/ltree/expected/ltree.out b/contrib/ltree/expected/ltree.out new file mode 100644 index 0000000..c6d8f3e --- /dev/null +++ b/contrib/ltree/expected/ltree.out @@ -0,0 +1,8086 @@ +CREATE EXTENSION ltree; +-- Check whether any of our opclasses fail amvalidate +SELECT amname, opcname +FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod +WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid); + amname | opcname +--------+--------- +(0 rows) + +SELECT ''::ltree; + ltree +------- + +(1 row) + +SELECT '1'::ltree; + ltree +------- + 1 +(1 row) + +SELECT '1.2'::ltree; + ltree +------- + 1.2 +(1 row) + +SELECT '1.2._3'::ltree; + ltree +-------- + 1.2._3 +(1 row) + +-- empty labels not allowed +SELECT '.2.3'::ltree; +ERROR: ltree syntax error at character 1 +LINE 1: SELECT '.2.3'::ltree; + ^ +SELECT '1..3'::ltree; +ERROR: ltree syntax error at character 3 +LINE 1: SELECT '1..3'::ltree; + ^ +SELECT '1.2.'::ltree; +ERROR: ltree syntax error +LINE 1: SELECT '1.2.'::ltree; + ^ +DETAIL: Unexpected end of input. +SELECT repeat('x', 255)::ltree; + repeat +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +(1 row) + +SELECT repeat('x', 256)::ltree; +ERROR: label string is too long +DETAIL: Label length is 256, must be at most 255, at character 257. +SELECT ltree2text('1.2.3.34.sdf'); + ltree2text +-------------- + 1.2.3.34.sdf +(1 row) + +SELECT text2ltree('1.2.3.34.sdf'); + text2ltree +-------------- + 1.2.3.34.sdf +(1 row) + +SELECT subltree('Top.Child1.Child2',1,2); + subltree +---------- + Child1 +(1 row) + +SELECT subpath('Top.Child1.Child2',1,2); + subpath +--------------- + Child1.Child2 +(1 row) + +SELECT subpath('Top.Child1.Child2',-1,1); + subpath +--------- + Child2 +(1 row) + +SELECT subpath('Top.Child1.Child2',0,-2); + subpath +--------- + Top +(1 row) + +SELECT subpath('Top.Child1.Child2',0,-1); + subpath +------------ + Top.Child1 +(1 row) + +SELECT subpath('Top.Child1.Child2',0,0); + subpath +--------- + +(1 row) + +SELECT subpath('Top.Child1.Child2',1,0); + subpath +--------- + +(1 row) + +SELECT subpath('Top.Child1.Child2',0); + subpath +------------------- + Top.Child1.Child2 +(1 row) + +SELECT subpath('Top.Child1.Child2',1); + subpath +--------------- + Child1.Child2 +(1 row) + +SELECT index('1.2.3.4.5.6','1.2'); + index +------- + 0 +(1 row) + +SELECT index('a.1.2.3.4.5.6','1.2'); + index +------- + 1 +(1 row) + +SELECT index('a.1.2.3.4.5.6','1.2.3'); + index +------- + 1 +(1 row) + +SELECT index('a.1.2.3.4.5.6','1.2.3.j'); + index +------- + -1 +(1 row) + +SELECT index('a.1.2.3.4.5.6','1.2.3.j.4.5.5.5.5.5.5'); + index +------- + -1 +(1 row) + +SELECT index('a.1.2.3.4.5.6','1.2.3'); + index +------- + 1 +(1 row) + +SELECT index('a.1.2.3.4.5.6','6'); + index +------- + 6 +(1 row) + +SELECT index('a.1.2.3.4.5.6','6.1'); + index +------- + -1 +(1 row) + +SELECT index('a.1.2.3.4.5.6','5.6'); + index +------- + 5 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6','5.6'); + index +------- + 6 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',3); + index +------- + 6 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',6); + index +------- + 6 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',7); + index +------- + 9 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-7); + index +------- + 6 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-4); + index +------- + 9 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-3); + index +------- + 9 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-2); + index +------- + -1 +(1 row) + +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-20000); + index +------- + 6 +(1 row) + +SELECT 'Top.Child1.Child2'::ltree || 'Child3'::text; + ?column? +-------------------------- + Top.Child1.Child2.Child3 +(1 row) + +SELECT 'Top.Child1.Child2'::ltree || 'Child3'::ltree; + ?column? +-------------------------- + Top.Child1.Child2.Child3 +(1 row) + +SELECT 'Top_0'::ltree || 'Top.Child1.Child2'::ltree; + ?column? +------------------------- + Top_0.Top.Child1.Child2 +(1 row) + +SELECT 'Top.Child1.Child2'::ltree || ''::ltree; + ?column? +------------------- + Top.Child1.Child2 +(1 row) + +SELECT ''::ltree || 'Top.Child1.Child2'::ltree; + ?column? +------------------- + Top.Child1.Child2 +(1 row) + +SELECT lca('{la.2.3,1.2.3.4.5.6,""}') IS NULL; + ?column? +---------- + t +(1 row) + +SELECT lca('{la.2.3,1.2.3.4.5.6}') IS NULL; + ?column? +---------- + f +(1 row) + +SELECT lca('{1.la.2.3,1.2.3.4.5.6}'); + lca +----- + 1 +(1 row) + +SELECT lca('{1.2.3,1.2.3.4.5.6}'); + lca +----- + 1.2 +(1 row) + +SELECT lca('{1.2.3}'); + lca +----- + 1.2 +(1 row) + +SELECT lca('{1}'), lca('{1}') IS NULL; + lca | ?column? +-----+---------- + | f +(1 row) + +SELECT lca('{}') IS NULL; + ?column? +---------- + t +(1 row) + +SELECT lca('1.la.2.3','1.2.3.4.5.6'); + lca +----- + 1 +(1 row) + +SELECT lca('1.2.3','1.2.3.4.5.6'); + lca +----- + 1.2 +(1 row) + +SELECT lca('1.2.2.3','1.2.3.4.5.6'); + lca +----- + 1.2 +(1 row) + +SELECT lca('1.2.2.3','1.2.3.4.5.6',''); + lca +----- + +(1 row) + +SELECT lca('1.2.2.3','1.2.3.4.5.6','2'); + lca +----- + +(1 row) + +SELECT lca('1.2.2.3','1.2.3.4.5.6','1'); + lca +----- + +(1 row) + +SELECT '1'::lquery; + lquery +-------- + 1 +(1 row) + +SELECT '4|3|2'::lquery; + lquery +-------- + 4|3|2 +(1 row) + +SELECT '1.2'::lquery; + lquery +-------- + 1.2 +(1 row) + +SELECT '1.4|3|2'::lquery; + lquery +--------- + 1.4|3|2 +(1 row) + +SELECT '1.0'::lquery; + lquery +-------- + 1.0 +(1 row) + +SELECT '4|3|2.0'::lquery; + lquery +--------- + 4|3|2.0 +(1 row) + +SELECT '1.2.0'::lquery; + lquery +-------- + 1.2.0 +(1 row) + +SELECT '1.4|3|2.0'::lquery; + lquery +----------- + 1.4|3|2.0 +(1 row) + +SELECT '1.*'::lquery; + lquery +-------- + 1.* +(1 row) + +SELECT '4|3|2.*'::lquery; + lquery +--------- + 4|3|2.* +(1 row) + +SELECT '1.2.*'::lquery; + lquery +-------- + 1.2.* +(1 row) + +SELECT '1.4|3|2.*'::lquery; + lquery +----------- + 1.4|3|2.* +(1 row) + +SELECT '*.1.*'::lquery; + lquery +-------- + *.1.* +(1 row) + +SELECT '*.4|3|2.*'::lquery; + lquery +----------- + *.4|3|2.* +(1 row) + +SELECT '*.1.2.*'::lquery; + lquery +--------- + *.1.2.* +(1 row) + +SELECT '*.1.4|3|2.*'::lquery; + lquery +------------- + *.1.4|3|2.* +(1 row) + +SELECT '1.*.4|3|2'::lquery; + lquery +----------- + 1.*.4|3|2 +(1 row) + +SELECT '1.*.4|3|2.0'::lquery; + lquery +------------- + 1.*.4|3|2.0 +(1 row) + +SELECT '1.*.4|3|2.*{1,4}'::lquery; + lquery +------------------ + 1.*.4|3|2.*{1,4} +(1 row) + +SELECT '1.*.4|3|2.*{,4}'::lquery; + lquery +----------------- + 1.*.4|3|2.*{,4} +(1 row) + +SELECT '1.*.4|3|2.*{1,}'::lquery; + lquery +----------------- + 1.*.4|3|2.*{1,} +(1 row) + +SELECT '1.*.4|3|2.*{1}'::lquery; + lquery +---------------- + 1.*.4|3|2.*{1} +(1 row) + +SELECT 'foo.bar{,}.!a*|b{1,}.c{,44}.d{3,4}'::lquery; + lquery +------------------------------------ + foo.bar{,}.!a*|b{1,}.c{,44}.d{3,4} +(1 row) + +SELECT 'foo*@@*'::lquery; + lquery +-------- + foo@* +(1 row) + +SELECT 'qwerty%@*.tu'::lquery; + lquery +-------------- + qwerty%@*.tu +(1 row) + +-- empty labels not allowed +SELECT '.2.3'::lquery; +ERROR: lquery syntax error at character 1 +LINE 1: SELECT '.2.3'::lquery; + ^ +SELECT '1..3'::lquery; +ERROR: lquery syntax error at character 3 +LINE 1: SELECT '1..3'::lquery; + ^ +SELECT '1.2.'::lquery; +ERROR: lquery syntax error +LINE 1: SELECT '1.2.'::lquery; + ^ +DETAIL: Unexpected end of input. +SELECT '@.2.3'::lquery; +ERROR: lquery syntax error at character 1 +LINE 1: SELECT '@.2.3'::lquery; + ^ +SELECT '1.@.3'::lquery; +ERROR: lquery syntax error at character 3 +LINE 1: SELECT '1.@.3'::lquery; + ^ +SELECT '1.2.@'::lquery; +ERROR: lquery syntax error at character 5 +LINE 1: SELECT '1.2.@'::lquery; + ^ +SELECT '!.2.3'::lquery; +ERROR: lquery syntax error at character 2 +LINE 1: SELECT '!.2.3'::lquery; + ^ +DETAIL: Empty labels are not allowed. +SELECT '1.!.3'::lquery; +ERROR: lquery syntax error at character 4 +LINE 1: SELECT '1.!.3'::lquery; + ^ +DETAIL: Empty labels are not allowed. +SELECT '1.2.!'::lquery; +ERROR: lquery syntax error at character 6 +LINE 1: SELECT '1.2.!'::lquery; + ^ +DETAIL: Empty labels are not allowed. +SELECT '1.2.3|@.4'::lquery; +ERROR: lquery syntax error at character 7 +LINE 1: SELECT '1.2.3|@.4'::lquery; + ^ +SELECT (repeat('x', 255) || '*@@*')::lquery; + lquery +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@* +(1 row) + +SELECT (repeat('x', 256) || '*@@*')::lquery; +ERROR: label string is too long +DETAIL: Label length is 256, must be at most 255, at character 257. +SELECT ('!' || repeat('x', 255))::lquery; + lquery +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + !xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +(1 row) + +SELECT ('!' || repeat('x', 256))::lquery; +ERROR: label string is too long +DETAIL: Label length is 256, must be at most 255, at character 258. +SELECT nlevel('1.2.3.4'); + nlevel +-------- + 4 +(1 row) + +SELECT nlevel(('1' || repeat('.1', 65534))::ltree); + nlevel +-------- + 65535 +(1 row) + +SELECT nlevel(('1' || repeat('.1', 65535))::ltree); +ERROR: number of ltree labels (65536) exceeds the maximum allowed (65535) +SELECT nlevel(('1' || repeat('.1', 65534))::ltree || '1'); +ERROR: number of ltree levels (65536) exceeds the maximum allowed (65535) +SELECT ('1' || repeat('.1', 65534))::lquery IS NULL; + ?column? +---------- + f +(1 row) + +SELECT ('1' || repeat('.1', 65535))::lquery IS NULL; +ERROR: number of lquery items (65536) exceeds the maximum allowed (65535) +SELECT '*{65535}'::lquery; + lquery +---------- + *{65535} +(1 row) + +SELECT '*{65536}'::lquery; +ERROR: lquery syntax error +LINE 1: SELECT '*{65536}'::lquery; + ^ +DETAIL: Low limit (65536) exceeds the maximum allowed (65535), at character 3. +SELECT '*{,65534}'::lquery; + lquery +----------- + *{,65534} +(1 row) + +SELECT '*{,65535}'::lquery; + lquery +-------- + * +(1 row) + +SELECT '*{,65536}'::lquery; +ERROR: lquery syntax error +LINE 1: SELECT '*{,65536}'::lquery; + ^ +DETAIL: High limit (65536) exceeds the maximum allowed (65535), at character 4. +SELECT '*{4,3}'::lquery; +ERROR: lquery syntax error +LINE 1: SELECT '*{4,3}'::lquery; + ^ +DETAIL: Low limit (4) is greater than high limit (3), at character 5. +SELECT '1.2'::ltree < '2.2'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '1.2'::ltree <= '2.2'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '2.2'::ltree = '2.2'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '3.2'::ltree >= '2.2'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '3.2'::ltree > '2.2'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '1.2.3'::ltree @> '1.2.3.4'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '1.2.3.4'::ltree @> '1.2.3.4'::ltree; + ?column? +---------- + t +(1 row) + +SELECT '1.2.3.4.5'::ltree @> '1.2.3.4'::ltree; + ?column? +---------- + f +(1 row) + +SELECT '1.3.3'::ltree @> '1.2.3.4'::ltree; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'A.b.c.d.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'A@.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'aa.b.c.d.e'::ltree ~ 'A@.b.c.d.e'; + ?column? +---------- + f +(1 row) + +SELECT 'aa.b.c.d.e'::ltree ~ 'A*.b.c.d.e'; + ?column? +---------- + f +(1 row) + +SELECT 'aa.b.c.d.e'::ltree ~ 'A*@.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'aa.b.c.d.e'::ltree ~ 'A*@|g.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'g.b.c.d.e'::ltree ~ 'A*@|g.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{3}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2}.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{4}.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{,4}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,4}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,3}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,3}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,4}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,5}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{2,3}.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{2,4}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{2,5}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.e.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!d'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!a.*'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!e.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!d'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!f.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.!f.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.a.!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.a.!d'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.!d.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.c.*'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*.c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.b.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.!c.*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.!c.*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{2}.!b.*.!c.*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*.!c.*.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*{1}.!c.*.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.!b.*{1}.!c.*.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.*{1}.!c.*.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*{1}.!c.*.e'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*.!c.*.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.!c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.!c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{2}.!b.*.!c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*.!c.*'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*{1}.!c.*'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.!b.*{1}.!c.*'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!b.*{1}.!c.*'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*{1}.!c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*.!c.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2}.*{2}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{1}.*{2}.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{1}.*{4}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{5}.*'; + ?column? +---------- + f +(1 row) + +SELECT '5.0.1.0'::ltree ~ '5.!0.!0.0'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b'::ltree ~ '!a.!a'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a{,}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a{1,}.*'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a{,}.!a{,}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.a'::ltree ~ 'a{,}.!a{,}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.a'::ltree ~ 'a{,2}.!a{1,}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ 'a{,2}.!a{1,}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!x{,}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!c{,}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!c{0,3}.!a{2,}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ~ '!c{0,3}.!d{2,}.*'; + ?column? +---------- + t +(1 row) + +SELECT 'QWER_TY'::ltree ~ 'q%@*'; + ?column? +---------- + t +(1 row) + +SELECT 'QWER_TY'::ltree ~ 'q%@*%@*'; + ?column? +---------- + t +(1 row) + +SELECT 'QWER_TY'::ltree ~ 'Q_t%@*'; + ?column? +---------- + t +(1 row) + +SELECT 'QWER_GY'::ltree ~ 'q_t%@*'; + ?column? +---------- + f +(1 row) + +--ltxtquery +SELECT '!tree & aWdf@*'::ltxtquery; + ltxtquery +---------------- + !tree & aWdf@* +(1 row) + +SELECT 'tree & aw_qw%*'::ltxtquery; + ltxtquery +---------------- + tree & aw_qw%* +(1 row) + +SELECT 'ltree.awdfg'::ltree @ '!tree & aWdf@*'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg'::ltree @ '!tree & aWdf@*'::ltxtquery; + ?column? +---------- + f +(1 row) + +SELECT 'tree.awdfg'::ltree @ '!tree | aWdf@*'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree | aWdf@*'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf@*'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf@'::ltxtquery; + ?column? +---------- + f +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf*'::ltxtquery; + ?column? +---------- + f +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf'::ltxtquery; + ?column? +---------- + f +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree & awdf*'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg'::ltree @ 'tree & aWdfg@'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg_qwerty'::ltree @ 'tree & aw_qw%*'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT 'tree.awdfg_qwerty'::ltree @ 'tree & aw_rw%*'::ltxtquery; + ?column? +---------- + f +(1 row) + +--arrays +SELECT '{1.2.3}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + t +(1 row) + +SELECT '{1.2.3.4}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + t +(1 row) + +SELECT '{1.2.3.4.5}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + f +(1 row) + +SELECT '{1.3.3}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + f +(1 row) + +SELECT '{5.67.8, 1.2.3}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + t +(1 row) + +SELECT '{5.67.8, 1.2.3.4}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + t +(1 row) + +SELECT '{5.67.8, 1.2.3.4.5}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + f +(1 row) + +SELECT '{5.67.8, 1.3.3}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + f +(1 row) + +SELECT '{1.2.3, 7.12.asd}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + t +(1 row) + +SELECT '{1.2.3.4, 7.12.asd}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + t +(1 row) + +SELECT '{1.2.3.4.5, 7.12.asd}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + f +(1 row) + +SELECT '{1.3.3, 7.12.asd}'::ltree[] @> '1.2.3.4'; + ?column? +---------- + f +(1 row) + +SELECT '{ltree.asd, tree.awdfg}'::ltree[] @ 'tree & aWdfg@'::ltxtquery; + ?column? +---------- + t +(1 row) + +SELECT '{j.k.l.m, g.b.c.d.e}'::ltree[] ~ 'A*@|g.b.c.d.e'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ? '{A.b.c.d.e}'; + ?column? +---------- + f +(1 row) + +SELECT 'a.b.c.d.e'::ltree ? '{a.b.c.d.e}'; + ?column? +---------- + t +(1 row) + +SELECT 'a.b.c.d.e'::ltree ? '{A.b.c.d.e, a.*}'; + ?column? +---------- + t +(1 row) + +SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e}'; + ?column? +---------- + f +(1 row) + +SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e,*.df}'; + ?column? +---------- + t +(1 row) + +--extractors +SELECT ('{3456,1.2.3.34}'::ltree[] ?@> '1.2.3.4') is null; + ?column? +---------- + t +(1 row) + +SELECT '{3456,1.2.3}'::ltree[] ?@> '1.2.3.4'; + ?column? +---------- + 1.2.3 +(1 row) + +SELECT '{3456,1.2.3.4}'::ltree[] ?<@ '1.2.3'; + ?column? +---------- + 1.2.3.4 +(1 row) + +SELECT ('{3456,1.2.3.4}'::ltree[] ?<@ '1.2.5') is null; + ?column? +---------- + t +(1 row) + +SELECT '{ltree.asd, tree.awdfg}'::ltree[] ?@ 'tree & aWdfg@'::ltxtquery; + ?column? +------------ + tree.awdfg +(1 row) + +SELECT '{j.k.l.m, g.b.c.d.e}'::ltree[] ?~ 'A*@|g.b.c.d.e'; + ?column? +----------- + g.b.c.d.e +(1 row) + +CREATE TABLE ltreetest (t ltree); +\copy ltreetest FROM 'data/ltree.data' +SELECT * FROM ltreetest WHERE t < '12.3' order by t asc; + t +---------------------------------- + + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 + 1.1.2 + 1.1.2.1 + 1.1.3 + 1.1.7.32.11.22 + 1.10.21 + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.10.5.22.13 + 1.11.10.19.6.1.26.17.2.22 + 1.12.25.26.22.8.15.23 + 1.13.16.27.11.16.30.2.9.18.4 + 1.14.3.7.3.17.2.29 + 1.15.17.6.28.25.24.31.27.9 + 1.16.8.18.14.16.21.25.6 + 1.18.29.30.22.14.3.20.15.21.20 + 1.19.22.11.14.7.32.23.19.14 + 1.20.18.25.3.24.25.10.9 + 1.20.22.26.2.6.11 + 1.21.28.4.23 + 1.22.19.24.8.11 + 1.22.29.5.16 + 1.25.7.9.26.17.31.20.13 + 1.26 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 1.28.19.8.25.6.20.27.29.27 + 1.28.3.22 + 1.29.18.1.21.12.13.27.32.15 + 1.3.15.11.11.25.24.21.19 + 1.30.18.31.12.25.4.19.28.12.15 + 1.30.31.31.20.16.7 + 1.31.3 + 1.4.14.32.14 + 1.8 + 1.9.18.10.1.26.22.16.17 + 10.11.25.2.24.18.18.21.6.26.21 + 10.12.23.22.23.22.20.17.17.9 + 10.12.9.6.6.26.14.8.23.1.25 + 10.13.12.8.4.8.11.30 + 10.13.22.1.8.30.9.24.1.2.1 + 10.15.16.3 + 10.16.18.9.27.2.29.32.24.13 + 10.16.19.7.15 + 10.18.12.27.24.30.32.7.11.5.13 + 10.2.17.26.16.7.19.6.23.3 + 10.20 + 10.22.1 + 10.22.30.16.2.21.17.13 + 10.26.27.23.4.31.11.25.29 + 10.26.30.15.1 + 10.27.7.24.26.11.31.20.29 + 10.28.22.29.13.19.6.7.6.14 + 10.28.7.16.31 + 10.29 + 10.29.26.4.27.17.11 + 10.3 + 10.3.19 + 10.31 + 10.31.25.31.24.16.17 + 10.32.14 + 10.5.23.5.32.9.18.5.30 + 10.5.5.15.29.2 + 10.7.9 + 10.8.20.11.12.23.22 + 11.1 + 11.1.3.28.30.21.24.14 + 11.10 + 11.10.22.18 + 11.11.11.4.23.21.25 + 11.11.9.30.15.29.15.18 + 11.12.6.21 + 11.14.21.24.10.7.29.23.24.28 + 11.15.11.19.29.10 + 11.16.16.28.14 + 11.17.10 + 11.17.17.24.11.23.17.17.18.10.22 + 11.18.4.8.3.13.14.28.18.31 + 11.19.23.3.6.11 + 11.2.27.3 + 11.21.13.9.19 + 11.21.16.27.16 + 11.22.28.8.12.23.25.15.21.28 + 11.29 + 11.3.15.28.22.8.14 + 11.30 + 11.30.20.15.18.32.1.18.25.26.8 + 11.32.18.31 + 11.6.11.29.4.5.24.6.26.12 + 11.7.31.15.22 + 11.8.18 + 12.1.1 + 12.1.28.22.25 + 12.10 + 12.10.11.9.10.31.4.16.31 + 12.11.17.1.2 + 12.11.20.20.29 + 12.13.16.17.29.27.16.14.9.19.9 + 12.13.5.31 + 12.14.20.8.28.4 + 12.15.10.17.18.13 + 12.16.13 + 12.16.2.4.15 + 12.17.10.7.17.16 + 12.18 + 12.2.4.28.21.30.24 + 12.21.15.27.24.15.8.24.24.26 + 12.21.20.20 + 12.22.20.4.12 + 12.23.3.19.29.15.12.6 + 12.24.29.32.32.29.2 + 12.25.32.2.27.3.3.16 + 12.27.23.32.1.1.9.29.13 + 12.27.30.12.24.2.20 + 12.28.12.24.28.15.5.12.30.13.21 + 12.29.17.2.20.29.1.11.19.8.12 + 12.29.26.18.4.21.28.8.13.3 +(123 rows) + +SELECT * FROM ltreetest WHERE t <= '12.3' order by t asc; + t +---------------------------------- + + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 + 1.1.2 + 1.1.2.1 + 1.1.3 + 1.1.7.32.11.22 + 1.10.21 + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.10.5.22.13 + 1.11.10.19.6.1.26.17.2.22 + 1.12.25.26.22.8.15.23 + 1.13.16.27.11.16.30.2.9.18.4 + 1.14.3.7.3.17.2.29 + 1.15.17.6.28.25.24.31.27.9 + 1.16.8.18.14.16.21.25.6 + 1.18.29.30.22.14.3.20.15.21.20 + 1.19.22.11.14.7.32.23.19.14 + 1.20.18.25.3.24.25.10.9 + 1.20.22.26.2.6.11 + 1.21.28.4.23 + 1.22.19.24.8.11 + 1.22.29.5.16 + 1.25.7.9.26.17.31.20.13 + 1.26 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 1.28.19.8.25.6.20.27.29.27 + 1.28.3.22 + 1.29.18.1.21.12.13.27.32.15 + 1.3.15.11.11.25.24.21.19 + 1.30.18.31.12.25.4.19.28.12.15 + 1.30.31.31.20.16.7 + 1.31.3 + 1.4.14.32.14 + 1.8 + 1.9.18.10.1.26.22.16.17 + 10.11.25.2.24.18.18.21.6.26.21 + 10.12.23.22.23.22.20.17.17.9 + 10.12.9.6.6.26.14.8.23.1.25 + 10.13.12.8.4.8.11.30 + 10.13.22.1.8.30.9.24.1.2.1 + 10.15.16.3 + 10.16.18.9.27.2.29.32.24.13 + 10.16.19.7.15 + 10.18.12.27.24.30.32.7.11.5.13 + 10.2.17.26.16.7.19.6.23.3 + 10.20 + 10.22.1 + 10.22.30.16.2.21.17.13 + 10.26.27.23.4.31.11.25.29 + 10.26.30.15.1 + 10.27.7.24.26.11.31.20.29 + 10.28.22.29.13.19.6.7.6.14 + 10.28.7.16.31 + 10.29 + 10.29.26.4.27.17.11 + 10.3 + 10.3.19 + 10.31 + 10.31.25.31.24.16.17 + 10.32.14 + 10.5.23.5.32.9.18.5.30 + 10.5.5.15.29.2 + 10.7.9 + 10.8.20.11.12.23.22 + 11.1 + 11.1.3.28.30.21.24.14 + 11.10 + 11.10.22.18 + 11.11.11.4.23.21.25 + 11.11.9.30.15.29.15.18 + 11.12.6.21 + 11.14.21.24.10.7.29.23.24.28 + 11.15.11.19.29.10 + 11.16.16.28.14 + 11.17.10 + 11.17.17.24.11.23.17.17.18.10.22 + 11.18.4.8.3.13.14.28.18.31 + 11.19.23.3.6.11 + 11.2.27.3 + 11.21.13.9.19 + 11.21.16.27.16 + 11.22.28.8.12.23.25.15.21.28 + 11.29 + 11.3.15.28.22.8.14 + 11.30 + 11.30.20.15.18.32.1.18.25.26.8 + 11.32.18.31 + 11.6.11.29.4.5.24.6.26.12 + 11.7.31.15.22 + 11.8.18 + 12.1.1 + 12.1.28.22.25 + 12.10 + 12.10.11.9.10.31.4.16.31 + 12.11.17.1.2 + 12.11.20.20.29 + 12.13.16.17.29.27.16.14.9.19.9 + 12.13.5.31 + 12.14.20.8.28.4 + 12.15.10.17.18.13 + 12.16.13 + 12.16.2.4.15 + 12.17.10.7.17.16 + 12.18 + 12.2.4.28.21.30.24 + 12.21.15.27.24.15.8.24.24.26 + 12.21.20.20 + 12.22.20.4.12 + 12.23.3.19.29.15.12.6 + 12.24.29.32.32.29.2 + 12.25.32.2.27.3.3.16 + 12.27.23.32.1.1.9.29.13 + 12.27.30.12.24.2.20 + 12.28.12.24.28.15.5.12.30.13.21 + 12.29.17.2.20.29.1.11.19.8.12 + 12.29.26.18.4.21.28.8.13.3 + 12.3 +(124 rows) + +SELECT * FROM ltreetest WHERE t = '12.3' order by t asc; + t +------ + 12.3 +(1 row) + +SELECT * FROM ltreetest WHERE t >= '12.3' order by t asc; + t +---------------------------------- + 12.3 + 12.4.10.17.4.10.23.3 + 12.4.12.13.25.30.30.8.9.12 + 12.4.24.6.1.13.5.20 + 12.4.26.23.25.5.15.7.16 + 12.6.14.23.19.21.9.12 + 12.7.16.8.21.22.2.16.18 + 12.7.28.26.14.21.18.31.5.15.11 + 13.1.6.17.28.9.15.30.1.27.14 + 13.12 + 13.14.13.10.28.26.9.18.27.21 + 13.16.1.27.18.18.19.6.14.4 + 13.16.4.28 + 13.17.7 + 13.19.2.6.23.19.9.7.21.8.16 + 13.24 + 13.25.10.25.8.16 + 13.26.17.3.2.19 + 13.28.12.6 + 13.28.14.2.8.18 + 13.28.9.3 + 13.3.20 + 13.3.8 + 13.30.24 + 13.32.15.32.26.14.32 + 13.7 + 13.8.15.3.7.31.5.10.15.30 + 13.8.20.9.21 + 13.8.23.13.11.18.24.21.11.24.10 + 13.9.9.27.31.11.25.9.27.22.13 + 14.1.11 + 14.1.15.25.27.23.25.26.28.10 + 14.10.11.30.5.7.6.24.9.30.26 + 14.11.25 + 14.12.31 + 14.13.9.13.11.5.5.2.2.32.12 + 14.14.25 + 14.15.31.29 + 14.16.6.29.26.13.14.16.25.26.8 + 14.17.7.30.8.25.26.4 + 14.19.20.13.27.2.2 + 14.19.26.15.22.23 + 14.19.30.6.4.10.10.10.22.25.11 + 14.2.14.11.12 + 14.21.22 + 14.21.5.28.3.32.24.14.25.31 + 14.21.6.5.26.9.32.16.25 + 14.23.31.5.5.15.17.12.17.7.3 + 14.24 + 14.26.25.4.12.26.8 + 14.27.29.23.4.1.17.32.6.25.22 + 14.29 + 14.3.17.1.14.15.21.4.26 + 14.30.13.5.26.9.22.23.14.10 + 14.30.2.21.15.16.13 + 14.30.23.3 + 14.4.19.27.28.24.19 + 14.4.23.4.23.22.11.6.26.5 + 14.5.13.19.25.12.32.9.13.16.12 + 14.6.10.29.25.26.20.24.24 + 14.8.15.30.7.29.27.31.4 + 14.9.15.21.21.31.1.29 + 15.1.6.31.30.13.32.9.10 + 15.1.8 + 15.10.30.1.4.12.8.20 + 15.11.26.1.30.6.23.5 + 15.17 + 15.17.2.32.7 + 15.21.22 + 15.21.23.30.9.25 + 15.23.26.20.27.7 + 15.25.31.11.4.22.16.7.11 + 15.26.24.31.16.15.17.22.8.30.3 + 15.28.24 + 15.28.30.19.31.6.2.2.31 + 15.29.25 + 15.29.32.16.29.12.20.32.13.20 + 15.3.31.9.27.14.9.8.14.6.32 + 15.30.17.5.32.28.2.18.27 + 15.31.11.27.19.19.20.5.5 + 15.4.15 + 15.5.1.31.28.10.8 + 15.6.19.3 + 15.7.3.14.23.19.26 + 15.7.5.12.7.9.3.28.26 + 15.8.10 + 15.8.3.15.27.14.29.28.6.5.25 + 15.9.11.20.22.15.11.13 + 15.9.8.20.27 + 16.13.19.11.18.13.17.17 + 16.13.2.19.14.29.31.30.23.15.12 + 16.13.26.18.9.29.11.17.1.24.26 + 16.14.3.17.17.26.12.19.19.30 + 16.16.28.24.11 + 16.18.23.6.31 + 16.19.17.30.30.5.17.24.27 + 16.2.14.3.26.11 + 16.20.29.26 + 16.21.13.1.4 + 16.23.30.12.31.31.19.14 + 16.24.3.30.15.22.31.2 + 16.24.7.25 + 16.27.8.17.14.17.21.29.14 + 16.28 + 16.29.6.23.13.28.31.6.19.26.15 + 16.30.10.7.29.4.9.21.22.13.26 + 16.31.12.27.25.9.32.29 + 16.5 + 16.5.10.2.18.8.15.12.32.25.10 + 16.5.12.5.15.12.24.25.3 + 16.5.14.21.32.17.23.3.4.26 + 16.5.23.17 + 16.5.6.12 + 16.8.29.7.21.2.3 + 16.9.14.28.6.21.31.31.26 + 16.9.29 + 16.9.32.14.3.7.8.7.21.22 + 17.1.12.20 + 17.10.17.22.20.25.14.13 + 17.11.17.4.8.26.26.20.6 + 17.13.14.29.27.27.13.12.15 + 17.13.19.31.12.18.10.15.14 + 17.13.8 + 17.14.7.3.2.18.20.23.18.5 + 17.17.14.28.6.30 + 17.19.1.22.11.7.22.1.14.28.11 + 17.22.12.10.30.11 + 17.24.15.27.3.32.4.22.20.6.24 + 17.24.30.6.32 + 17.25.10.13.21.5.7.22.2 + 17.25.2.13.10.27.13.1 + 17.25.26.23.32 + 17.26.18 + 17.27 + 17.29.21.10.18.8.16.26.18.21.26 + 17.29.31.8.24.10.18.27.17 + 17.3 + 17.5.3.15.17.13.5 + 17.7.26.30.18.23.4 + 17.8 + 17.8.31.32 + 17.9.32.31.21.31.23.17.10.32.9 + 18.13.6.12.26.26.26.29.18.20.1 + 18.13.9.3.18.15.2 + 18.15.14 + 18.17.6.16.6.10 + 18.18.19.16.14.16.21.10.25 + 18.18.5.11.7.4.25 + 18.19.11.20.13.13.11 + 18.19.12.20.18.17.15.32.18.5 + 18.21 + 18.24.21.17.11.26.28.22.21.18.10 + 18.27.11.27.9.16.7.6.22.26.27 + 18.29.13.24.18.3.12.18.12.12 + 18.29.5.1.10.21.2 + 18.30.11.17 + 18.30.18.31 + 18.31.26.18.6.15.18.11 + 18.31.32.28.1.4.24.24.12.25 + 18.31.32.29.22.1.31.11.28 + 18.4 + 18.4.14.29.3 + 18.5.6.31.5.15.15 + 18.6.2.2.24 + 18.6.26.2.13.9.6.11.10.11.16 + 18.7.10.27.17.24 + 18.7.3.17.13.5.31.6.31.25.29 + 18.9.21.2.31.8.32 + 18.9.26.7 + 19.10.26.19.5.21.30.23 + 19.10.4.30.32.4.12 + 19.10.8.10.4.19 + 19.11.10.18.14.13.7.7 + 19.11.29.13.15.27.12.15.14.12 + 19.12.20.24.32.13.11.23.26 + 19.12.26.24.29.3 + 19.12.30.2.21 + 19.15.26.19 + 19.16.26.2 + 19.16.31.31.29.12 + 19.17.12.15 + 19.17.13.12.32.16.3 + 19.19.25.22.11.6.15.3.2.19 + 19.2.26.21.16.11.2.2 + 19.2.9.29.6 + 19.20.25.7.27.28.27.17.9.3.1 + 19.22.21.13.27.13.15 + 19.22.29.32.1.21.26.24.23.17 + 19.26.24.27.6.24.16.27.32.29 + 19.26.32.13.1.12.30.26.22.25 + 19.3.12.12 + 19.3.23.4.4.21.23 + 19.30.18.11.32.14 + 19.30.27.26.21.7.18 + 19.31.14.25.5.8.21.11.13.20 + 19.5.20.3.4.2.3 + 19.6.13.14.22.13.9.29 + 19.6.24.32.30.13.6.25.8.28 + 19.7 + 19.7.29.31.3.20.7.21.25.27.29 + 19.9.32.23.13.24.1 + 2.1.12.19.29.28.3.31.28.28.10 + 2.1.3.30.24.17.9 + 2.10.10.4.20.1.12.13 + 2.10.28.1.17.19.32.28 + 2.11.32.25.23 + 2.12.14.28.16.21 + 2.12.30.22.12 + 2.13.9.23.21.2 + 2.13.9.28 + 2.14.10.4.17.17.8.4.27.20 + 2.14.12.13 + 2.15.14.20.30.26 + 2.15.18.21.5.21.4.7.30 + 2.16.3.7.22.18.29.20 + 2.19.4.1.15.7.8.9.17.29 + 2.2.18.18.3.3.18.8.10.8 + 2.22.19 + 2.24.4.5.24.32 + 2.24.5.3.4.10.27.26.17.28.16 + 2.27.15.14 + 2.28.5.17.6.32 + 2.30.26.10.14.31.18.2 + 2.31.25 + 2.32.10.13.12 + 2.32.8.28.24.20.9.24.25.8.9 + 2.4.25.32.16.22.26.13.17.18 + 2.6.15.26.23.26.24 + 2.8.13.12.17.23.16.7.11.23 + 2.9 + 20.1.24.3.30.31 + 20.13 + 20.14.11.2.10.14 + 20.15 + 20.17.14.7 + 20.17.18.21.1 + 20.18.24.14.12.13.9 + 20.20.32.29.24.5.5.26.22.32 + 20.20.7 + 20.22.10 + 20.23.29.5.7.30.13.14.22 + 20.23.7.11.11.31.18.16.3 + 20.24.14.15.4.21.12.27.4.12 + 20.25.22.19.22 + 20.28.22.7.10.28.27.22.14.16 + 20.29.18.16.2.21.23.11 + 20.3.1.8.8.30.20 + 20.30.17 + 20.30.28.15.17 + 20.30.9.9.14.12.29 + 20.31.13.12.19.2.26.16.16.22.28 + 20.32.5.1.3.20.3.30.27 + 20.32.9 + 20.4.1.16.31.3 + 20.4.27.31.1 + 20.5.4.9.31.14.26.6 + 20.6.26.3.30 + 20.6.3.26.7.29.28.4 + 20.8.19.14.16.7 + 20.9.29.32.13.7.23 + 21.1.4.9.9.31.24.21.3.29 + 21.10.20.9.3.16.9.10.20 + 21.14 + 21.14.13 + 21.14.22.29 + 21.14.25.20.13.31.14.20 + 21.15.18.18.30.3.20 + 21.15.31.24.29.24.26.12.20 + 21.17.18.32.7.8 + 21.17.27.23.15 + 21.17.31.10.31.13.9.26.6.14 + 21.18 + 21.18.2.1 + 21.18.30.19.24.24 + 21.20.24.25.6.26.23 + 21.20.28.19.27.9 + 21.21.10.27 + 21.22.31.24.27 + 21.23.13 + 21.23.17.8.23.11.8.1 + 21.28.17.22.10.27.4.20.2.32 + 21.28.24.23.3.11.7.12.22.32 + 21.30.19.6.28.1.32.2.14.14 + 21.31.31.25.5.30.26 + 21.32.13.21 + 21.32.13.22.3.13.31.23.14.12.9 + 21.4.11.18 + 21.4.22.20.24.28.6 + 21.5.11.18 + 21.5.17.19.15.25.18.21.24.9 + 21.6.22.28.12.23.11.22 + 21.7.23.9.16.5.18.14 + 21.7.7.11 + 21.8.9 + 21.9.27.22.32 + 21.9.32.1.27 + 22.10.12.23.9 + 22.10.16.8 + 22.10.18 + 22.10.27.19.29.20.29.3.12.14.25 + 22.11 + 22.12.22.28 + 22.13.22.21.25.17.8 + 22.13.22.8.30.32.10.24 + 22.15 + 22.16 + 22.16.25.18.25.7.24.29.14.8 + 22.17.24.14.21.15.12.18.17.25.11 + 22.17.30 + 22.17.4.2.22.17 + 22.17.7.30.13.24 + 22.17.9.11.25.15.3.9 + 22.18.20.23.15.9.12 + 22.19.20.5.2.20 + 22.19.21.11.6.8.29.24 + 22.19.5.22.20.31.23.24.14.24.4 + 22.20.30 + 22.21.32.15.8.29.5.12.10.29 + 22.22.10.30.5.15.25.21.19.11 + 22.22.27.6.27.15.5.18.21.28.9 + 22.23.18.18.9.8.23.7.23.23.16 + 22.23.22.30 + 22.23.25.28.5.27.9.9.24.31.10 + 22.24.22.25.15.23.13 + 22.25.4.28.9.20.12.13 + 22.26.1.28.9.9.31 + 22.26.32 + 22.28.20.6.32.32 + 22.29.18.32.13.12.22.31.17.22 + 22.29.29.11 + 22.3.6 + 22.30 + 22.30.31.24.23.22.5.20.28.1 + 22.31.2.32.32.11.26.23.19 + 22.31.21.13.13.26.11.5.19 + 22.32.6.6.3.8.24.6.25.29 + 22.8.20.1.10.28.6.27 + 22.9.15.19.12 + 23.1.23.18.12.29 + 23.10.13.32.14.20.16.11.14 + 23.10.5.26.12.4.20.4 + 23.12.1.5.32.25.8.24.1.25 + 23.12.11.11.15.16.22.31.32.5.8 + 23.12.19.25.16.23.22.6.29.4 + 23.12.32.22.19.1.22.4 + 23.14.12.30.18.4.16.18.7.7 + 23.14.30.27.28.26.26.23.8.32 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.17.28.31.28 + 23.17.32.15.23.16.25 + 23.19.17.31.29.13.1.12.5.25 + 23.2.22.7.32.3.27.6 + 23.20.12.16.15.2 + 23.20.24 + 23.20.8 + 23.22.10.1.14.24 + 23.22.23.14.31.32 + 23.23 + 23.24.11.31.10.31.18.28.13.18.6 + 23.24.16.32.13.29 + 23.25.23.11.7.23 + 23.27.27.16 + 23.27.6.26.22 + 23.28.1 + 23.28.20.25.30.24.15 + 23.28.3.30.15.31.32.3.21.9.19 + 23.3.20.24 + 23.3.32.21.5.14.10.17.1 + 23.31.27.16.8.30.20.27 + 23.32.5.25.19.9.15.17.15.11 + 23.5.5.17 + 23.5.7.12.11.23.10 + 23.6.27 + 23.8.13.22.21 + 24.1.10.20.28.18.6.27.20.30.26 + 24.1.29.32.14.15.32.6.15.22 + 24.10.10.31.4.29.9 + 24.10.8.25.16 + 24.11.5 + 24.12 + 24.13.1.8 + 24.15.15.17.22 + 24.16.27.10.9 + 24.17.24 + 24.17.31.20.12.9.19.29.18 + 24.18.16 + 24.2.26.24.14.15.31.23.17.26 + 24.2.6.7.16.7.28 + 24.20.23 + 24.21.14.25.11.3.20.6.6.16 + 24.23.24.4.15.25.17 + 24.23.29.8.24.11.21.10.28.14.27 + 24.24 + 24.25.7.27.30.8.26.17 + 24.27.14 + 24.27.18.32.14.9.11.28.9 + 24.28.13.26.8.8.31 + 24.28.32.21 + 24.3.23.25 + 24.31 + 24.31.2.13.5.23.18.16 + 24.31.8 + 24.32.17.23.24.19.23.9.20.18 + 24.32.27 + 24.9 + 24.9.15.1.14.29.6.4 + 24.9.27.16.20.21 + 24.9.8.12.29 + 25.10 + 25.10.29.3.6.21.3.31.13 + 25.10.4.28.3.31.19 + 25.11.24 + 25.14.5.32.25 + 25.15.11 + 25.16.9.6 + 25.17.18.17.27 + 25.17.18.30 + 25.17.2.20.20.3.29.21.3.12 + 25.17.9.16.17.31.23.29.24 + 25.18.8.3.23.23.5.9.6 + 25.19.27.2.9.20 + 25.2.11.20.8.6.22 + 25.2.3.15.11.19.5.28.25.14 + 25.21.8.17 + 25.22.2.25.6 + 25.24.2.32.14.18.16 + 25.24.29 + 25.28.3 + 25.28.30.24 + 25.29 + 25.3 + 25.30.1.4.24.11 + 25.31 + 25.32.24.24.28.15.16.10 + 25.4.32 + 25.4.4.1.13.32.26.20.20.3 + 25.5.30.7.16.12.21.12.11.16 + 25.6 + 25.6.12.16.1 + 25.7.3.21.31.12.28 + 25.9 + 25.9.1.5.9.11.25.4.11.27.32 + 25.9.10 + 26.11 + 26.12.27.2 + 26.13.4.7.13.11.3 + 26.14 + 26.14.5.32.10 + 26.16.12 + 26.16.12.3.27.9.28 + 26.17.9.13.4.25.32.2.24.9 + 26.18 + 26.18.32.20 + 26.19.3.14.8.28.31.10 + 26.24 + 26.24.9.12.11.15.31.2 + 26.25.10.10.13 + 26.25.24 + 26.26.22.21.14.11.29.19.14.24 + 26.28.14 + 26.31.11.23.3 + 26.31.16.18.22.13.32.23.9.20 + 26.31.6.8.29.8.24 + 26.31.7 + 26.32.21.31.27.12 + 26.32.8.12.30.19.24.8.6.1.10 + 26.5.29.7.28 + 26.7.22.3.18.21.11 + 26.7.5.8.11.9.22.1.6 + 26.8.28 + 26.9.17.1.18.19.1.11.18.29.3 + 26.9.20.12.22.22.32 + 27.1.11.3.25.9.6.6 + 27.11.14.17.24 + 27.11.15.9.24.31.18.4.1.30.20 + 27.12.4.2.29.22.15 + 27.15.15.15 + 27.16 + 27.17.15.7.28.20 + 27.17.17.19.24.9.14.20 + 27.17.3.18.2.13.18 + 27.18 + 27.18.10.4.22 + 27.19.20.1.31.29.5.22.26.3 + 27.2.10.4.25.14.2.15.4 + 27.21.27.5.13.30.17 + 27.21.28.24.7.2.24.23.8 + 27.22.11.13.21.25.5.1.27.21.27 + 27.23.2.32.11.21 + 27.23.20.30.7 + 27.24.11.31.21.6.29.17.24.18 + 27.25 + 27.26.29 + 27.27 + 27.27.25.10.31.10.21.22.21.16.12 + 27.27.30.11.15.24.9.7.4.30 + 27.29.1.5.30.6.22.16.23.2.28 + 27.3 + 27.3.3.11.21.4.25 + 27.30.12.11.20.15.11.13 + 27.31.2.16.29.6 + 27.32.26.21.31.17.32.32 + 27.4 + 27.4.15.14.19.6.12 + 27.4.17.17.32.8.16.15.17.13 + 27.5.15.1.15.16.21 + 27.5.22 + 27.6.13.24.21.27.28.22.3.7.4 + 28.1.3 + 28.11.11.30.20.11.32 + 28.11.27.21.14.16 + 28.14.24.26.6.15.16.32.25.13.8 + 28.14.32.29.2.3.4 + 28.15.18.27 + 28.15.25.7.13.6.19.2 + 28.17.26.9 + 28.18.6.22.13.8.25 + 28.2.27.1.20 + 28.20.8.9.9.28.30.29 + 28.23.2.30.3.8.1.15.15.14.13 + 28.25.10.25.19.15 + 28.25.11.22 + 28.25.29.4.13.5.6 + 28.26.25.7 + 28.26.26.6.31 + 28.26.4.22.13.20.32.27.15 + 28.27.24.14 + 28.28 + 28.30.24.16.17.28.2.13.10 + 28.31.10.28.22.26.16.15 + 28.4 + 28.5.12.9.2.27.11.11.2 + 28.5.13 + 28.6 + 28.6.11.6.15.22.12.6 + 28.6.8.22.25 + 28.8.21.15.16.28.4.16.26.8 + 28.9.3.16.17.21.23.30 + 29.1 + 29.1.2.14.14 + 29.1.7.26.25.11.22 + 29.10.12.17.12.16 + 29.10.17.11.28.12.18.5.19.15.21 + 29.11.20.22.27 + 29.14.12.9.17.5.32 + 29.14.31.25.7.32.23 + 29.15.29.8.31.26.1 + 29.20.1.11.21.16.1.2.14.28 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 29.25.29.16.32.11.15.25.5.22.3 + 29.25.30.15.21.3.25.26.26 + 29.26.25.14.24.18.2.13.23.29 + 29.27 + 29.27.13.29.10.2 + 29.27.13.9.28.29.19.13.29.31.27 + 29.27.5.22.26 + 29.27.7.7.3.11.14.26.21.11 + 29.28.9.15.8.27.31 + 29.29.17.31 + 29.29.18 + 29.3.15.17.12.29 + 29.3.17.17.18.32 + 29.30.21.8.16.23.32 + 29.30.7.31.22 + 29.32.13.4.1.16.20 + 29.5.18.27.3.21.18.6.14 + 29.5.32.20.11.7.13.24.17 + 29.6.12.31.20.23.32.20 + 29.9.25.27.15.16.32.26.6.32 + 3.1.13.22.24.14.12.31.3.4 + 3.1.14.8.9.16.30.22.20 + 3.10 + 3.10.27.4.5.6.19.12.28.12 + 3.10.4.5.28.11 + 3.11.18.21.5.20.30 + 3.11.32.11.22.3.7.17.8.13.23 + 3.13 + 3.14.1.14.17.28.29.16 + 3.14.11.15.21.32.2.15.13 + 3.14.30.5.32.22.29 + 3.15.2.23.22.2.16.14 + 3.18 + 3.18.18 + 3.18.8.22.7.28.32.31.3 + 3.19.11.6.5 + 3.20.16.13.29.20 + 3.20.19.10.17.27.3.6.22.23 + 3.21.16.24.23.12.16.32.3 + 3.21.6.13.12.18.25 + 3.22.18.1.5.14.9.6.14 + 3.25 + 3.26 + 3.26.32 + 3.27.18.8.4.21.6.32.30.7.5 + 3.29.19.2.24 + 3.29.32.26.8.10.25 + 3.3 + 3.32.2.29.3.32.28.11.29.30 + 3.4.22.19 + 3.5 + 3.6.24.21.20.32.3.4.26.5 + 3.9.11.23.32.26.24.28 + 3.9.25.26.7 + 30.12.28.2 + 30.12.6.30 + 30.12.9.25.24.6.7.24.29 + 30.15 + 30.16.14.9.5.4.10.7.31 + 30.16.3.21.10 + 30.17.2.25 + 30.17.25.3.31.11.3.4.1.10 + 30.17.4.5.13.6 + 30.18.30.16.29 + 30.2.17.8.14 + 30.20.3.2.5.15.8.7.17 + 30.22.29.21.19.14.3.2.6 + 30.23.10.1.10.7.22.28.18.11.17 + 30.23.2.13.14.15.29.19.4.12.24 + 30.24 + 30.24.23.25.32.18.22.12.29.9.22 + 30.24.32.15.14.10.11 + 30.25 + 30.25.17.17.10.29 + 30.25.24.22 + 30.25.8.24.6.29.31 + 30.27.8.6.11.19 + 30.3.16.26.7.27.26.9.27.21.18 + 30.30.17.5.30.21.19.5.22.22.14 + 30.31.13.9 + 30.32 + 30.4.30.11.13.23.14.24.11 + 30.5 + 30.6.4 + 30.8.18.5.20.6.15 + 30.8.9.14.25.30 + 30.9.24 + 31.13 + 31.13.9.1.5.12 + 31.17 + 31.17.2.30.11 + 31.18 + 31.18.25.1.14.29.25.5.22.30 + 31.18.27.15.20.29.29 + 31.18.32.11.7.25.20.5 + 31.21.14.20.1.22.2.5.3.27.12 + 31.21.22.14.8.21 + 31.24.26.18 + 31.28.32.4.31.4.7 + 31.29.18.26.1.26.17 + 31.29.4.29.24.30.30.32.10.23 + 31.30.12.20 + 31.30.23.7.7.24.32.10.11.1.31 + 31.32.12.26.31.32.14.23.28 + 31.4.7 + 31.5.6.4.8.29.3 + 31.7.14.2 + 31.9.3.5 + 32.1.21.1.16.29.21 + 32.1.23.20.14.12.23.5.32.15 + 32.1.24.29.22.5.9.24.18.3.13 + 32.1.31 + 32.15.20.28.5.1.23.4 + 32.16 + 32.17.8.24.2.14.5.4.22 + 32.19.20.24.23.31.8.32.16.29 + 32.2.11 + 32.24.11.8.12.23.22.19.11.17.18 + 32.24.29.6 + 32.25.16 + 32.25.3.6 + 32.27.13.6.7 + 32.27.18.7.3.4.2 + 32.28.1.32.28.10 + 32.29.24.31.25.6.9 + 32.3.12.2 + 32.3.23.7.2 + 32.3.5.9.17.15 + 32.30.18.17.1.14.12.18 + 32.31.11.22.1 + 32.31.26.19.13.29.4.25 + 32.4.19 + 32.6.13.8.32 + 32.6.15.26.14.15.3.19 + 32.6.3.2.12.5.28.1.25 + 32.6.31.31 + 32.6.8 + 32.6.9.26.16.4.4.29.7.11 + 32.8.29.18.31 + 32.8.5 + 4.1.24.24.28.24.18 + 4.10.28 + 4.11.19.17.2.22.20.18.13.32.15 + 4.11.22.4.19.24.4.28.6.8.22 + 4.13 + 4.13.22.11.9.13.27.15.7 + 4.14 + 4.14.10.19.16 + 4.14.16.14.1.8.1.22.17.10 + 4.14.17.12.20.17.1.22.3 + 4.14.32 + 4.15.20.23.12.16.2.16.17 + 4.16.22.19.24.21 + 4.16.7.25.21.7 + 4.18.29.9.16.10 + 4.19.16.15.5.2.25.8.28.14.2 + 4.2.16.13.16.11.19.10.10.25 + 4.2.2.32.24.25.31.3 + 4.2.6.20.7.8 + 4.21.28.5.16.29.5.21 + 4.21.9.1.2.14.8.17.13.26 + 4.22 + 4.22.17.10.19.9.8.19.28.3.9 + 4.22.7.19.25 + 4.25.12.10.15.9.18.9 + 4.26.2.2 + 4.26.23.6.19.31.10.4.22 + 4.26.5.26.21.28.17.24.25.23 + 4.27.32.18 + 4.3.20.27.9.1.18.30.12.5.19 + 4.3.6.27.22.23.10 + 4.30.8.20.19.9.30.24.11 + 4.31 + 4.5.9.4.15.19.8.26.17.26.3 + 4.7.1 + 4.9 + 5.1.5.31 + 5.10 + 5.10.2.11.21.9.19 + 5.10.3.9.23.30.23 + 5.12.2.20.1.24.25 + 5.13.23.19.28.26.27.6.1.22 + 5.13.23.4.9 + 5.14.27.15.11.17.3.10.27.25 + 5.14.29.2.23.16.20.22 + 5.15.10.3.23.13.32.23 + 5.15.16 + 5.18.9.25.31.21.22 + 5.19.1.26.20.6.20 + 5.2.32.19.13.29.12.13.31.29 + 5.20 + 5.21.27.13.14.11.2.16.20 + 5.23.31.18.24.32 + 5.24.24.9.32.26.31 + 5.24.25.15.27.30.20 + 5.24.4.31.3.16.25.17.13.26.11 + 5.27.16.3.30 + 5.27.21.1.29.29.28 + 5.27.28.26.14.15.6.20.1.31.13 + 5.27.32.21.5.1.11.14 + 5.3.17.29 + 5.3.29.9.22 + 5.31.8.1.5.13.21.28.29.19.2 + 5.4.8.25.12.27.2.29.28.3 + 5.5.12.31.23.13.17.22.20 + 5.8 + 5.8.17.30.15.8.19.29.30.11.6 + 5.9.19.6 + 6.1.8.6.30.29.30 + 6.10.25.12 + 6.11.11.5.16.8.14.12.9 + 6.11.31.23.12.8.30.14.27 + 6.13.31.5.7.26 + 6.14 + 6.17.10.10.7.9.27.8.29 + 6.17.26.25.27.11.10.9 + 6.18.1.4.18.23 + 6.19.29.11.2.32.21.15.32.9 + 6.19.3 + 6.19.6.4.9.11.32.17.17.3.15 + 6.2.32 + 6.20 + 6.20.14 + 6.21.30.7 + 6.22.12 + 6.25.17.32 + 6.26 + 6.26.29.10.21.28.20.19 + 6.27.26.1.20.24.6 + 6.27.29.14.8.12.26.3.21.4.1 + 6.29.32.13.30.3.16 + 6.29.6.13.14.24.10.4.14.28 + 6.5.27.19.13.26.1.18.9 + 6.6.22.8 + 6.7.25.16.13.21.7.20.25.12.4 + 6.7.7 + 6.8.7.20.2 + 6.9.1.10.10.22.6 + 6.9.29.17.4.32 + 7.10.17.21.11.29.17.25.19.4.29 + 7.11 + 7.12 + 7.12.1.10.6.17.29.24.24.4 + 7.12.23 + 7.13 + 7.13.15 + 7.14.22.29.30.14.25.1.9.26.25 + 7.16.20.17 + 7.19.10.12.31.1.27.13.19 + 7.19.12.3.21.19.18.5.2.14.10 + 7.19.6.17.15.26.21.9 + 7.21.8 + 7.23.1.24.29.13.31.19.23.17.7 + 7.23.15.32.28.27.2.2.26 + 7.26.18 + 7.27.20 + 7.30.19.25.23.15.14.29 + 7.30.5.10.10.5.30.14.9.18 + 7.31 + 7.31.2.28.15.11.17.18.19.23.6 + 7.31.4.20.17 + 7.32.10.3.30.12.14 + 7.5.28.8.17.26.31.10.15 + 7.7 + 7.7.22.24.17.32.17.25.28 + 7.7.25.22.22.26 + 8.1.29.18.22 + 8.10 + 8.11.20 + 8.12.4 + 8.13.1 + 8.13.14.11.11.29.22.4.4.10 + 8.13.6.12.18.7 + 8.13.9.31.20.20.24.7.23.31.28 + 8.14.19.18 + 8.16 + 8.16.1.16.28.6.3.22.6.23 + 8.16.20.24.20.6.10.21 + 8.16.30.29.19.22.28.24.2 + 8.16.6 + 8.17.25.26.15.25 + 8.17.9.15.21.28.1.7.1.3.6 + 8.2 + 8.2.18.23.5.16.17.1 + 8.21.17.3.6.3.18 + 8.21.8.23.4.18 + 8.22.32.17.16.28.31.23.22.9 + 8.24.11.13.25.19 + 8.25.20.3.15.24.7.4.24.5.30 + 8.26.29.13.7.25.31.28.3.32 + 8.27.3.4.12.26.16 + 8.29.6.3 + 8.3.18.13.30.20.27.26.17.28 + 8.3.3.25.25.15.7.13.21.18 + 8.31.22.27 + 8.32.30.1 + 8.5.24.9.29.32.31.30.13.9.7 + 8.5.30.29.9.31 + 8.6.6.5.8.8.12 + 8.9.21.16.29 + 8.9.22 + 8.9.25.25.26.30.31.31.2.32.7 + 9.10.19.18.15.11.22.32.32.14.9 + 9.10.32 + 9.14.27.31.26.21.25.3.20 + 9.16.2.16.22.24.17.31.14.21.17 + 9.17.13.31.7 + 9.18.23 + 9.18.30.11.29.32.7.19.2 + 9.19.7.13.13.25 + 9.2.10.4 + 9.2.4.27.26 + 9.21.14.19 + 9.21.20.29.1 + 9.21.28.8.12.15.3.13.10.11 + 9.22.10.15.5.15 + 9.23.21.22.5.29.15.21 + 9.26.1.16 + 9.28.10.26.14.26.15.14 + 9.28.24 + 9.28.30.1.6.25.17.9 + 9.3.3 + 9.3.31.18.12.3.9.29.10 + 9.30 + 9.31.23.19.5.10.16.4.30.24.5 + 9.31.4.14.31.10.17.5.2 + 9.5 + 9.5.9.3.23.9.25.14.1.29.28 + 9.6.9.21.6.11.29.13.29.20.32 + 9.7.31.11.8.23 + 9.8.23.2.20.16 + 9.9.13.9.14.27 +(883 rows) + +SELECT * FROM ltreetest WHERE t > '12.3' order by t asc; + t +---------------------------------- + 12.4.10.17.4.10.23.3 + 12.4.12.13.25.30.30.8.9.12 + 12.4.24.6.1.13.5.20 + 12.4.26.23.25.5.15.7.16 + 12.6.14.23.19.21.9.12 + 12.7.16.8.21.22.2.16.18 + 12.7.28.26.14.21.18.31.5.15.11 + 13.1.6.17.28.9.15.30.1.27.14 + 13.12 + 13.14.13.10.28.26.9.18.27.21 + 13.16.1.27.18.18.19.6.14.4 + 13.16.4.28 + 13.17.7 + 13.19.2.6.23.19.9.7.21.8.16 + 13.24 + 13.25.10.25.8.16 + 13.26.17.3.2.19 + 13.28.12.6 + 13.28.14.2.8.18 + 13.28.9.3 + 13.3.20 + 13.3.8 + 13.30.24 + 13.32.15.32.26.14.32 + 13.7 + 13.8.15.3.7.31.5.10.15.30 + 13.8.20.9.21 + 13.8.23.13.11.18.24.21.11.24.10 + 13.9.9.27.31.11.25.9.27.22.13 + 14.1.11 + 14.1.15.25.27.23.25.26.28.10 + 14.10.11.30.5.7.6.24.9.30.26 + 14.11.25 + 14.12.31 + 14.13.9.13.11.5.5.2.2.32.12 + 14.14.25 + 14.15.31.29 + 14.16.6.29.26.13.14.16.25.26.8 + 14.17.7.30.8.25.26.4 + 14.19.20.13.27.2.2 + 14.19.26.15.22.23 + 14.19.30.6.4.10.10.10.22.25.11 + 14.2.14.11.12 + 14.21.22 + 14.21.5.28.3.32.24.14.25.31 + 14.21.6.5.26.9.32.16.25 + 14.23.31.5.5.15.17.12.17.7.3 + 14.24 + 14.26.25.4.12.26.8 + 14.27.29.23.4.1.17.32.6.25.22 + 14.29 + 14.3.17.1.14.15.21.4.26 + 14.30.13.5.26.9.22.23.14.10 + 14.30.2.21.15.16.13 + 14.30.23.3 + 14.4.19.27.28.24.19 + 14.4.23.4.23.22.11.6.26.5 + 14.5.13.19.25.12.32.9.13.16.12 + 14.6.10.29.25.26.20.24.24 + 14.8.15.30.7.29.27.31.4 + 14.9.15.21.21.31.1.29 + 15.1.6.31.30.13.32.9.10 + 15.1.8 + 15.10.30.1.4.12.8.20 + 15.11.26.1.30.6.23.5 + 15.17 + 15.17.2.32.7 + 15.21.22 + 15.21.23.30.9.25 + 15.23.26.20.27.7 + 15.25.31.11.4.22.16.7.11 + 15.26.24.31.16.15.17.22.8.30.3 + 15.28.24 + 15.28.30.19.31.6.2.2.31 + 15.29.25 + 15.29.32.16.29.12.20.32.13.20 + 15.3.31.9.27.14.9.8.14.6.32 + 15.30.17.5.32.28.2.18.27 + 15.31.11.27.19.19.20.5.5 + 15.4.15 + 15.5.1.31.28.10.8 + 15.6.19.3 + 15.7.3.14.23.19.26 + 15.7.5.12.7.9.3.28.26 + 15.8.10 + 15.8.3.15.27.14.29.28.6.5.25 + 15.9.11.20.22.15.11.13 + 15.9.8.20.27 + 16.13.19.11.18.13.17.17 + 16.13.2.19.14.29.31.30.23.15.12 + 16.13.26.18.9.29.11.17.1.24.26 + 16.14.3.17.17.26.12.19.19.30 + 16.16.28.24.11 + 16.18.23.6.31 + 16.19.17.30.30.5.17.24.27 + 16.2.14.3.26.11 + 16.20.29.26 + 16.21.13.1.4 + 16.23.30.12.31.31.19.14 + 16.24.3.30.15.22.31.2 + 16.24.7.25 + 16.27.8.17.14.17.21.29.14 + 16.28 + 16.29.6.23.13.28.31.6.19.26.15 + 16.30.10.7.29.4.9.21.22.13.26 + 16.31.12.27.25.9.32.29 + 16.5 + 16.5.10.2.18.8.15.12.32.25.10 + 16.5.12.5.15.12.24.25.3 + 16.5.14.21.32.17.23.3.4.26 + 16.5.23.17 + 16.5.6.12 + 16.8.29.7.21.2.3 + 16.9.14.28.6.21.31.31.26 + 16.9.29 + 16.9.32.14.3.7.8.7.21.22 + 17.1.12.20 + 17.10.17.22.20.25.14.13 + 17.11.17.4.8.26.26.20.6 + 17.13.14.29.27.27.13.12.15 + 17.13.19.31.12.18.10.15.14 + 17.13.8 + 17.14.7.3.2.18.20.23.18.5 + 17.17.14.28.6.30 + 17.19.1.22.11.7.22.1.14.28.11 + 17.22.12.10.30.11 + 17.24.15.27.3.32.4.22.20.6.24 + 17.24.30.6.32 + 17.25.10.13.21.5.7.22.2 + 17.25.2.13.10.27.13.1 + 17.25.26.23.32 + 17.26.18 + 17.27 + 17.29.21.10.18.8.16.26.18.21.26 + 17.29.31.8.24.10.18.27.17 + 17.3 + 17.5.3.15.17.13.5 + 17.7.26.30.18.23.4 + 17.8 + 17.8.31.32 + 17.9.32.31.21.31.23.17.10.32.9 + 18.13.6.12.26.26.26.29.18.20.1 + 18.13.9.3.18.15.2 + 18.15.14 + 18.17.6.16.6.10 + 18.18.19.16.14.16.21.10.25 + 18.18.5.11.7.4.25 + 18.19.11.20.13.13.11 + 18.19.12.20.18.17.15.32.18.5 + 18.21 + 18.24.21.17.11.26.28.22.21.18.10 + 18.27.11.27.9.16.7.6.22.26.27 + 18.29.13.24.18.3.12.18.12.12 + 18.29.5.1.10.21.2 + 18.30.11.17 + 18.30.18.31 + 18.31.26.18.6.15.18.11 + 18.31.32.28.1.4.24.24.12.25 + 18.31.32.29.22.1.31.11.28 + 18.4 + 18.4.14.29.3 + 18.5.6.31.5.15.15 + 18.6.2.2.24 + 18.6.26.2.13.9.6.11.10.11.16 + 18.7.10.27.17.24 + 18.7.3.17.13.5.31.6.31.25.29 + 18.9.21.2.31.8.32 + 18.9.26.7 + 19.10.26.19.5.21.30.23 + 19.10.4.30.32.4.12 + 19.10.8.10.4.19 + 19.11.10.18.14.13.7.7 + 19.11.29.13.15.27.12.15.14.12 + 19.12.20.24.32.13.11.23.26 + 19.12.26.24.29.3 + 19.12.30.2.21 + 19.15.26.19 + 19.16.26.2 + 19.16.31.31.29.12 + 19.17.12.15 + 19.17.13.12.32.16.3 + 19.19.25.22.11.6.15.3.2.19 + 19.2.26.21.16.11.2.2 + 19.2.9.29.6 + 19.20.25.7.27.28.27.17.9.3.1 + 19.22.21.13.27.13.15 + 19.22.29.32.1.21.26.24.23.17 + 19.26.24.27.6.24.16.27.32.29 + 19.26.32.13.1.12.30.26.22.25 + 19.3.12.12 + 19.3.23.4.4.21.23 + 19.30.18.11.32.14 + 19.30.27.26.21.7.18 + 19.31.14.25.5.8.21.11.13.20 + 19.5.20.3.4.2.3 + 19.6.13.14.22.13.9.29 + 19.6.24.32.30.13.6.25.8.28 + 19.7 + 19.7.29.31.3.20.7.21.25.27.29 + 19.9.32.23.13.24.1 + 2.1.12.19.29.28.3.31.28.28.10 + 2.1.3.30.24.17.9 + 2.10.10.4.20.1.12.13 + 2.10.28.1.17.19.32.28 + 2.11.32.25.23 + 2.12.14.28.16.21 + 2.12.30.22.12 + 2.13.9.23.21.2 + 2.13.9.28 + 2.14.10.4.17.17.8.4.27.20 + 2.14.12.13 + 2.15.14.20.30.26 + 2.15.18.21.5.21.4.7.30 + 2.16.3.7.22.18.29.20 + 2.19.4.1.15.7.8.9.17.29 + 2.2.18.18.3.3.18.8.10.8 + 2.22.19 + 2.24.4.5.24.32 + 2.24.5.3.4.10.27.26.17.28.16 + 2.27.15.14 + 2.28.5.17.6.32 + 2.30.26.10.14.31.18.2 + 2.31.25 + 2.32.10.13.12 + 2.32.8.28.24.20.9.24.25.8.9 + 2.4.25.32.16.22.26.13.17.18 + 2.6.15.26.23.26.24 + 2.8.13.12.17.23.16.7.11.23 + 2.9 + 20.1.24.3.30.31 + 20.13 + 20.14.11.2.10.14 + 20.15 + 20.17.14.7 + 20.17.18.21.1 + 20.18.24.14.12.13.9 + 20.20.32.29.24.5.5.26.22.32 + 20.20.7 + 20.22.10 + 20.23.29.5.7.30.13.14.22 + 20.23.7.11.11.31.18.16.3 + 20.24.14.15.4.21.12.27.4.12 + 20.25.22.19.22 + 20.28.22.7.10.28.27.22.14.16 + 20.29.18.16.2.21.23.11 + 20.3.1.8.8.30.20 + 20.30.17 + 20.30.28.15.17 + 20.30.9.9.14.12.29 + 20.31.13.12.19.2.26.16.16.22.28 + 20.32.5.1.3.20.3.30.27 + 20.32.9 + 20.4.1.16.31.3 + 20.4.27.31.1 + 20.5.4.9.31.14.26.6 + 20.6.26.3.30 + 20.6.3.26.7.29.28.4 + 20.8.19.14.16.7 + 20.9.29.32.13.7.23 + 21.1.4.9.9.31.24.21.3.29 + 21.10.20.9.3.16.9.10.20 + 21.14 + 21.14.13 + 21.14.22.29 + 21.14.25.20.13.31.14.20 + 21.15.18.18.30.3.20 + 21.15.31.24.29.24.26.12.20 + 21.17.18.32.7.8 + 21.17.27.23.15 + 21.17.31.10.31.13.9.26.6.14 + 21.18 + 21.18.2.1 + 21.18.30.19.24.24 + 21.20.24.25.6.26.23 + 21.20.28.19.27.9 + 21.21.10.27 + 21.22.31.24.27 + 21.23.13 + 21.23.17.8.23.11.8.1 + 21.28.17.22.10.27.4.20.2.32 + 21.28.24.23.3.11.7.12.22.32 + 21.30.19.6.28.1.32.2.14.14 + 21.31.31.25.5.30.26 + 21.32.13.21 + 21.32.13.22.3.13.31.23.14.12.9 + 21.4.11.18 + 21.4.22.20.24.28.6 + 21.5.11.18 + 21.5.17.19.15.25.18.21.24.9 + 21.6.22.28.12.23.11.22 + 21.7.23.9.16.5.18.14 + 21.7.7.11 + 21.8.9 + 21.9.27.22.32 + 21.9.32.1.27 + 22.10.12.23.9 + 22.10.16.8 + 22.10.18 + 22.10.27.19.29.20.29.3.12.14.25 + 22.11 + 22.12.22.28 + 22.13.22.21.25.17.8 + 22.13.22.8.30.32.10.24 + 22.15 + 22.16 + 22.16.25.18.25.7.24.29.14.8 + 22.17.24.14.21.15.12.18.17.25.11 + 22.17.30 + 22.17.4.2.22.17 + 22.17.7.30.13.24 + 22.17.9.11.25.15.3.9 + 22.18.20.23.15.9.12 + 22.19.20.5.2.20 + 22.19.21.11.6.8.29.24 + 22.19.5.22.20.31.23.24.14.24.4 + 22.20.30 + 22.21.32.15.8.29.5.12.10.29 + 22.22.10.30.5.15.25.21.19.11 + 22.22.27.6.27.15.5.18.21.28.9 + 22.23.18.18.9.8.23.7.23.23.16 + 22.23.22.30 + 22.23.25.28.5.27.9.9.24.31.10 + 22.24.22.25.15.23.13 + 22.25.4.28.9.20.12.13 + 22.26.1.28.9.9.31 + 22.26.32 + 22.28.20.6.32.32 + 22.29.18.32.13.12.22.31.17.22 + 22.29.29.11 + 22.3.6 + 22.30 + 22.30.31.24.23.22.5.20.28.1 + 22.31.2.32.32.11.26.23.19 + 22.31.21.13.13.26.11.5.19 + 22.32.6.6.3.8.24.6.25.29 + 22.8.20.1.10.28.6.27 + 22.9.15.19.12 + 23.1.23.18.12.29 + 23.10.13.32.14.20.16.11.14 + 23.10.5.26.12.4.20.4 + 23.12.1.5.32.25.8.24.1.25 + 23.12.11.11.15.16.22.31.32.5.8 + 23.12.19.25.16.23.22.6.29.4 + 23.12.32.22.19.1.22.4 + 23.14.12.30.18.4.16.18.7.7 + 23.14.30.27.28.26.26.23.8.32 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.17.28.31.28 + 23.17.32.15.23.16.25 + 23.19.17.31.29.13.1.12.5.25 + 23.2.22.7.32.3.27.6 + 23.20.12.16.15.2 + 23.20.24 + 23.20.8 + 23.22.10.1.14.24 + 23.22.23.14.31.32 + 23.23 + 23.24.11.31.10.31.18.28.13.18.6 + 23.24.16.32.13.29 + 23.25.23.11.7.23 + 23.27.27.16 + 23.27.6.26.22 + 23.28.1 + 23.28.20.25.30.24.15 + 23.28.3.30.15.31.32.3.21.9.19 + 23.3.20.24 + 23.3.32.21.5.14.10.17.1 + 23.31.27.16.8.30.20.27 + 23.32.5.25.19.9.15.17.15.11 + 23.5.5.17 + 23.5.7.12.11.23.10 + 23.6.27 + 23.8.13.22.21 + 24.1.10.20.28.18.6.27.20.30.26 + 24.1.29.32.14.15.32.6.15.22 + 24.10.10.31.4.29.9 + 24.10.8.25.16 + 24.11.5 + 24.12 + 24.13.1.8 + 24.15.15.17.22 + 24.16.27.10.9 + 24.17.24 + 24.17.31.20.12.9.19.29.18 + 24.18.16 + 24.2.26.24.14.15.31.23.17.26 + 24.2.6.7.16.7.28 + 24.20.23 + 24.21.14.25.11.3.20.6.6.16 + 24.23.24.4.15.25.17 + 24.23.29.8.24.11.21.10.28.14.27 + 24.24 + 24.25.7.27.30.8.26.17 + 24.27.14 + 24.27.18.32.14.9.11.28.9 + 24.28.13.26.8.8.31 + 24.28.32.21 + 24.3.23.25 + 24.31 + 24.31.2.13.5.23.18.16 + 24.31.8 + 24.32.17.23.24.19.23.9.20.18 + 24.32.27 + 24.9 + 24.9.15.1.14.29.6.4 + 24.9.27.16.20.21 + 24.9.8.12.29 + 25.10 + 25.10.29.3.6.21.3.31.13 + 25.10.4.28.3.31.19 + 25.11.24 + 25.14.5.32.25 + 25.15.11 + 25.16.9.6 + 25.17.18.17.27 + 25.17.18.30 + 25.17.2.20.20.3.29.21.3.12 + 25.17.9.16.17.31.23.29.24 + 25.18.8.3.23.23.5.9.6 + 25.19.27.2.9.20 + 25.2.11.20.8.6.22 + 25.2.3.15.11.19.5.28.25.14 + 25.21.8.17 + 25.22.2.25.6 + 25.24.2.32.14.18.16 + 25.24.29 + 25.28.3 + 25.28.30.24 + 25.29 + 25.3 + 25.30.1.4.24.11 + 25.31 + 25.32.24.24.28.15.16.10 + 25.4.32 + 25.4.4.1.13.32.26.20.20.3 + 25.5.30.7.16.12.21.12.11.16 + 25.6 + 25.6.12.16.1 + 25.7.3.21.31.12.28 + 25.9 + 25.9.1.5.9.11.25.4.11.27.32 + 25.9.10 + 26.11 + 26.12.27.2 + 26.13.4.7.13.11.3 + 26.14 + 26.14.5.32.10 + 26.16.12 + 26.16.12.3.27.9.28 + 26.17.9.13.4.25.32.2.24.9 + 26.18 + 26.18.32.20 + 26.19.3.14.8.28.31.10 + 26.24 + 26.24.9.12.11.15.31.2 + 26.25.10.10.13 + 26.25.24 + 26.26.22.21.14.11.29.19.14.24 + 26.28.14 + 26.31.11.23.3 + 26.31.16.18.22.13.32.23.9.20 + 26.31.6.8.29.8.24 + 26.31.7 + 26.32.21.31.27.12 + 26.32.8.12.30.19.24.8.6.1.10 + 26.5.29.7.28 + 26.7.22.3.18.21.11 + 26.7.5.8.11.9.22.1.6 + 26.8.28 + 26.9.17.1.18.19.1.11.18.29.3 + 26.9.20.12.22.22.32 + 27.1.11.3.25.9.6.6 + 27.11.14.17.24 + 27.11.15.9.24.31.18.4.1.30.20 + 27.12.4.2.29.22.15 + 27.15.15.15 + 27.16 + 27.17.15.7.28.20 + 27.17.17.19.24.9.14.20 + 27.17.3.18.2.13.18 + 27.18 + 27.18.10.4.22 + 27.19.20.1.31.29.5.22.26.3 + 27.2.10.4.25.14.2.15.4 + 27.21.27.5.13.30.17 + 27.21.28.24.7.2.24.23.8 + 27.22.11.13.21.25.5.1.27.21.27 + 27.23.2.32.11.21 + 27.23.20.30.7 + 27.24.11.31.21.6.29.17.24.18 + 27.25 + 27.26.29 + 27.27 + 27.27.25.10.31.10.21.22.21.16.12 + 27.27.30.11.15.24.9.7.4.30 + 27.29.1.5.30.6.22.16.23.2.28 + 27.3 + 27.3.3.11.21.4.25 + 27.30.12.11.20.15.11.13 + 27.31.2.16.29.6 + 27.32.26.21.31.17.32.32 + 27.4 + 27.4.15.14.19.6.12 + 27.4.17.17.32.8.16.15.17.13 + 27.5.15.1.15.16.21 + 27.5.22 + 27.6.13.24.21.27.28.22.3.7.4 + 28.1.3 + 28.11.11.30.20.11.32 + 28.11.27.21.14.16 + 28.14.24.26.6.15.16.32.25.13.8 + 28.14.32.29.2.3.4 + 28.15.18.27 + 28.15.25.7.13.6.19.2 + 28.17.26.9 + 28.18.6.22.13.8.25 + 28.2.27.1.20 + 28.20.8.9.9.28.30.29 + 28.23.2.30.3.8.1.15.15.14.13 + 28.25.10.25.19.15 + 28.25.11.22 + 28.25.29.4.13.5.6 + 28.26.25.7 + 28.26.26.6.31 + 28.26.4.22.13.20.32.27.15 + 28.27.24.14 + 28.28 + 28.30.24.16.17.28.2.13.10 + 28.31.10.28.22.26.16.15 + 28.4 + 28.5.12.9.2.27.11.11.2 + 28.5.13 + 28.6 + 28.6.11.6.15.22.12.6 + 28.6.8.22.25 + 28.8.21.15.16.28.4.16.26.8 + 28.9.3.16.17.21.23.30 + 29.1 + 29.1.2.14.14 + 29.1.7.26.25.11.22 + 29.10.12.17.12.16 + 29.10.17.11.28.12.18.5.19.15.21 + 29.11.20.22.27 + 29.14.12.9.17.5.32 + 29.14.31.25.7.32.23 + 29.15.29.8.31.26.1 + 29.20.1.11.21.16.1.2.14.28 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 29.25.29.16.32.11.15.25.5.22.3 + 29.25.30.15.21.3.25.26.26 + 29.26.25.14.24.18.2.13.23.29 + 29.27 + 29.27.13.29.10.2 + 29.27.13.9.28.29.19.13.29.31.27 + 29.27.5.22.26 + 29.27.7.7.3.11.14.26.21.11 + 29.28.9.15.8.27.31 + 29.29.17.31 + 29.29.18 + 29.3.15.17.12.29 + 29.3.17.17.18.32 + 29.30.21.8.16.23.32 + 29.30.7.31.22 + 29.32.13.4.1.16.20 + 29.5.18.27.3.21.18.6.14 + 29.5.32.20.11.7.13.24.17 + 29.6.12.31.20.23.32.20 + 29.9.25.27.15.16.32.26.6.32 + 3.1.13.22.24.14.12.31.3.4 + 3.1.14.8.9.16.30.22.20 + 3.10 + 3.10.27.4.5.6.19.12.28.12 + 3.10.4.5.28.11 + 3.11.18.21.5.20.30 + 3.11.32.11.22.3.7.17.8.13.23 + 3.13 + 3.14.1.14.17.28.29.16 + 3.14.11.15.21.32.2.15.13 + 3.14.30.5.32.22.29 + 3.15.2.23.22.2.16.14 + 3.18 + 3.18.18 + 3.18.8.22.7.28.32.31.3 + 3.19.11.6.5 + 3.20.16.13.29.20 + 3.20.19.10.17.27.3.6.22.23 + 3.21.16.24.23.12.16.32.3 + 3.21.6.13.12.18.25 + 3.22.18.1.5.14.9.6.14 + 3.25 + 3.26 + 3.26.32 + 3.27.18.8.4.21.6.32.30.7.5 + 3.29.19.2.24 + 3.29.32.26.8.10.25 + 3.3 + 3.32.2.29.3.32.28.11.29.30 + 3.4.22.19 + 3.5 + 3.6.24.21.20.32.3.4.26.5 + 3.9.11.23.32.26.24.28 + 3.9.25.26.7 + 30.12.28.2 + 30.12.6.30 + 30.12.9.25.24.6.7.24.29 + 30.15 + 30.16.14.9.5.4.10.7.31 + 30.16.3.21.10 + 30.17.2.25 + 30.17.25.3.31.11.3.4.1.10 + 30.17.4.5.13.6 + 30.18.30.16.29 + 30.2.17.8.14 + 30.20.3.2.5.15.8.7.17 + 30.22.29.21.19.14.3.2.6 + 30.23.10.1.10.7.22.28.18.11.17 + 30.23.2.13.14.15.29.19.4.12.24 + 30.24 + 30.24.23.25.32.18.22.12.29.9.22 + 30.24.32.15.14.10.11 + 30.25 + 30.25.17.17.10.29 + 30.25.24.22 + 30.25.8.24.6.29.31 + 30.27.8.6.11.19 + 30.3.16.26.7.27.26.9.27.21.18 + 30.30.17.5.30.21.19.5.22.22.14 + 30.31.13.9 + 30.32 + 30.4.30.11.13.23.14.24.11 + 30.5 + 30.6.4 + 30.8.18.5.20.6.15 + 30.8.9.14.25.30 + 30.9.24 + 31.13 + 31.13.9.1.5.12 + 31.17 + 31.17.2.30.11 + 31.18 + 31.18.25.1.14.29.25.5.22.30 + 31.18.27.15.20.29.29 + 31.18.32.11.7.25.20.5 + 31.21.14.20.1.22.2.5.3.27.12 + 31.21.22.14.8.21 + 31.24.26.18 + 31.28.32.4.31.4.7 + 31.29.18.26.1.26.17 + 31.29.4.29.24.30.30.32.10.23 + 31.30.12.20 + 31.30.23.7.7.24.32.10.11.1.31 + 31.32.12.26.31.32.14.23.28 + 31.4.7 + 31.5.6.4.8.29.3 + 31.7.14.2 + 31.9.3.5 + 32.1.21.1.16.29.21 + 32.1.23.20.14.12.23.5.32.15 + 32.1.24.29.22.5.9.24.18.3.13 + 32.1.31 + 32.15.20.28.5.1.23.4 + 32.16 + 32.17.8.24.2.14.5.4.22 + 32.19.20.24.23.31.8.32.16.29 + 32.2.11 + 32.24.11.8.12.23.22.19.11.17.18 + 32.24.29.6 + 32.25.16 + 32.25.3.6 + 32.27.13.6.7 + 32.27.18.7.3.4.2 + 32.28.1.32.28.10 + 32.29.24.31.25.6.9 + 32.3.12.2 + 32.3.23.7.2 + 32.3.5.9.17.15 + 32.30.18.17.1.14.12.18 + 32.31.11.22.1 + 32.31.26.19.13.29.4.25 + 32.4.19 + 32.6.13.8.32 + 32.6.15.26.14.15.3.19 + 32.6.3.2.12.5.28.1.25 + 32.6.31.31 + 32.6.8 + 32.6.9.26.16.4.4.29.7.11 + 32.8.29.18.31 + 32.8.5 + 4.1.24.24.28.24.18 + 4.10.28 + 4.11.19.17.2.22.20.18.13.32.15 + 4.11.22.4.19.24.4.28.6.8.22 + 4.13 + 4.13.22.11.9.13.27.15.7 + 4.14 + 4.14.10.19.16 + 4.14.16.14.1.8.1.22.17.10 + 4.14.17.12.20.17.1.22.3 + 4.14.32 + 4.15.20.23.12.16.2.16.17 + 4.16.22.19.24.21 + 4.16.7.25.21.7 + 4.18.29.9.16.10 + 4.19.16.15.5.2.25.8.28.14.2 + 4.2.16.13.16.11.19.10.10.25 + 4.2.2.32.24.25.31.3 + 4.2.6.20.7.8 + 4.21.28.5.16.29.5.21 + 4.21.9.1.2.14.8.17.13.26 + 4.22 + 4.22.17.10.19.9.8.19.28.3.9 + 4.22.7.19.25 + 4.25.12.10.15.9.18.9 + 4.26.2.2 + 4.26.23.6.19.31.10.4.22 + 4.26.5.26.21.28.17.24.25.23 + 4.27.32.18 + 4.3.20.27.9.1.18.30.12.5.19 + 4.3.6.27.22.23.10 + 4.30.8.20.19.9.30.24.11 + 4.31 + 4.5.9.4.15.19.8.26.17.26.3 + 4.7.1 + 4.9 + 5.1.5.31 + 5.10 + 5.10.2.11.21.9.19 + 5.10.3.9.23.30.23 + 5.12.2.20.1.24.25 + 5.13.23.19.28.26.27.6.1.22 + 5.13.23.4.9 + 5.14.27.15.11.17.3.10.27.25 + 5.14.29.2.23.16.20.22 + 5.15.10.3.23.13.32.23 + 5.15.16 + 5.18.9.25.31.21.22 + 5.19.1.26.20.6.20 + 5.2.32.19.13.29.12.13.31.29 + 5.20 + 5.21.27.13.14.11.2.16.20 + 5.23.31.18.24.32 + 5.24.24.9.32.26.31 + 5.24.25.15.27.30.20 + 5.24.4.31.3.16.25.17.13.26.11 + 5.27.16.3.30 + 5.27.21.1.29.29.28 + 5.27.28.26.14.15.6.20.1.31.13 + 5.27.32.21.5.1.11.14 + 5.3.17.29 + 5.3.29.9.22 + 5.31.8.1.5.13.21.28.29.19.2 + 5.4.8.25.12.27.2.29.28.3 + 5.5.12.31.23.13.17.22.20 + 5.8 + 5.8.17.30.15.8.19.29.30.11.6 + 5.9.19.6 + 6.1.8.6.30.29.30 + 6.10.25.12 + 6.11.11.5.16.8.14.12.9 + 6.11.31.23.12.8.30.14.27 + 6.13.31.5.7.26 + 6.14 + 6.17.10.10.7.9.27.8.29 + 6.17.26.25.27.11.10.9 + 6.18.1.4.18.23 + 6.19.29.11.2.32.21.15.32.9 + 6.19.3 + 6.19.6.4.9.11.32.17.17.3.15 + 6.2.32 + 6.20 + 6.20.14 + 6.21.30.7 + 6.22.12 + 6.25.17.32 + 6.26 + 6.26.29.10.21.28.20.19 + 6.27.26.1.20.24.6 + 6.27.29.14.8.12.26.3.21.4.1 + 6.29.32.13.30.3.16 + 6.29.6.13.14.24.10.4.14.28 + 6.5.27.19.13.26.1.18.9 + 6.6.22.8 + 6.7.25.16.13.21.7.20.25.12.4 + 6.7.7 + 6.8.7.20.2 + 6.9.1.10.10.22.6 + 6.9.29.17.4.32 + 7.10.17.21.11.29.17.25.19.4.29 + 7.11 + 7.12 + 7.12.1.10.6.17.29.24.24.4 + 7.12.23 + 7.13 + 7.13.15 + 7.14.22.29.30.14.25.1.9.26.25 + 7.16.20.17 + 7.19.10.12.31.1.27.13.19 + 7.19.12.3.21.19.18.5.2.14.10 + 7.19.6.17.15.26.21.9 + 7.21.8 + 7.23.1.24.29.13.31.19.23.17.7 + 7.23.15.32.28.27.2.2.26 + 7.26.18 + 7.27.20 + 7.30.19.25.23.15.14.29 + 7.30.5.10.10.5.30.14.9.18 + 7.31 + 7.31.2.28.15.11.17.18.19.23.6 + 7.31.4.20.17 + 7.32.10.3.30.12.14 + 7.5.28.8.17.26.31.10.15 + 7.7 + 7.7.22.24.17.32.17.25.28 + 7.7.25.22.22.26 + 8.1.29.18.22 + 8.10 + 8.11.20 + 8.12.4 + 8.13.1 + 8.13.14.11.11.29.22.4.4.10 + 8.13.6.12.18.7 + 8.13.9.31.20.20.24.7.23.31.28 + 8.14.19.18 + 8.16 + 8.16.1.16.28.6.3.22.6.23 + 8.16.20.24.20.6.10.21 + 8.16.30.29.19.22.28.24.2 + 8.16.6 + 8.17.25.26.15.25 + 8.17.9.15.21.28.1.7.1.3.6 + 8.2 + 8.2.18.23.5.16.17.1 + 8.21.17.3.6.3.18 + 8.21.8.23.4.18 + 8.22.32.17.16.28.31.23.22.9 + 8.24.11.13.25.19 + 8.25.20.3.15.24.7.4.24.5.30 + 8.26.29.13.7.25.31.28.3.32 + 8.27.3.4.12.26.16 + 8.29.6.3 + 8.3.18.13.30.20.27.26.17.28 + 8.3.3.25.25.15.7.13.21.18 + 8.31.22.27 + 8.32.30.1 + 8.5.24.9.29.32.31.30.13.9.7 + 8.5.30.29.9.31 + 8.6.6.5.8.8.12 + 8.9.21.16.29 + 8.9.22 + 8.9.25.25.26.30.31.31.2.32.7 + 9.10.19.18.15.11.22.32.32.14.9 + 9.10.32 + 9.14.27.31.26.21.25.3.20 + 9.16.2.16.22.24.17.31.14.21.17 + 9.17.13.31.7 + 9.18.23 + 9.18.30.11.29.32.7.19.2 + 9.19.7.13.13.25 + 9.2.10.4 + 9.2.4.27.26 + 9.21.14.19 + 9.21.20.29.1 + 9.21.28.8.12.15.3.13.10.11 + 9.22.10.15.5.15 + 9.23.21.22.5.29.15.21 + 9.26.1.16 + 9.28.10.26.14.26.15.14 + 9.28.24 + 9.28.30.1.6.25.17.9 + 9.3.3 + 9.3.31.18.12.3.9.29.10 + 9.30 + 9.31.23.19.5.10.16.4.30.24.5 + 9.31.4.14.31.10.17.5.2 + 9.5 + 9.5.9.3.23.9.25.14.1.29.28 + 9.6.9.21.6.11.29.13.29.20.32 + 9.7.31.11.8.23 + 9.8.23.2.20.16 + 9.9.13.9.14.27 +(882 rows) + +SELECT * FROM ltreetest WHERE t @> '1.1.1' order by t asc; + t +------- + + 1 + 1.1 + 1.1.1 +(4 rows) + +SELECT * FROM ltreetest WHERE t <@ '1.1.1' order by t asc; + t +----------- + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 +(4 rows) + +SELECT * FROM ltreetest WHERE t @ '23 & 1' order by t asc; + t +-------------------------------- + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.12.25.26.22.8.15.23 + 1.19.22.11.14.7.32.23.19.14 + 1.21.28.4.23 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 10.12.9.6.6.26.14.8.23.1.25 + 12.27.23.32.1.1.9.29.13 + 14.1.15.25.27.23.25.26.28.10 + 14.27.29.23.4.1.17.32.6.25.22 + 15.11.26.1.30.6.23.5 + 19.22.29.32.1.21.26.24.23.17 + 19.9.32.23.13.24.1 + 21.23.17.8.23.11.8.1 + 22.30.31.24.23.22.5.20.28.1 + 23.1.23.18.12.29 + 23.12.1.5.32.25.8.24.1.25 + 23.12.32.22.19.1.22.4 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.19.17.31.29.13.1.12.5.25 + 23.22.10.1.14.24 + 23.28.1 + 23.3.32.21.5.14.10.17.1 + 27.29.1.5.30.6.22.16.23.2.28 + 28.23.2.30.3.8.1.15.15.14.13 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 30.23.10.1.10.7.22.28.18.11.17 + 31.30.23.7.7.24.32.10.11.1.31 + 32.1.23.20.14.12.23.5.32.15 + 32.15.20.28.5.1.23.4 + 5.13.23.19.28.26.27.6.1.22 + 6.18.1.4.18.23 + 7.23.1.24.29.13.31.19.23.17.7 + 8.16.1.16.28.6.3.22.6.23 + 8.2.18.23.5.16.17.1 + 9.5.9.3.23.9.25.14.1.29.28 +(39 rows) + +SELECT * FROM ltreetest WHERE t ~ '1.1.1.*' order by t asc; + t +----------- + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 +(4 rows) + +SELECT * FROM ltreetest WHERE t ~ '*.1' order by t asc; + t +-------------------------------- + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2.1 + 1.1.2.1 + 1.26.15.23.5.31.29.11.19.28.1 + 10.13.22.1.8.30.9.24.1.2.1 + 10.22.1 + 10.26.30.15.1 + 11.1 + 12.1.1 + 17.25.2.13.10.27.13.1 + 18.13.6.12.26.26.26.29.18.20.1 + 19.20.25.7.27.28.27.17.9.3.1 + 19.9.32.23.13.24.1 + 20.17.18.21.1 + 20.4.27.31.1 + 21.18.2.1 + 21.23.17.8.23.11.8.1 + 22.30.31.24.23.22.5.20.28.1 + 23.17.22.1.23.4.29.32.4.1 + 23.28.1 + 23.3.32.21.5.14.10.17.1 + 25.6.12.16.1 + 29.1 + 29.15.29.8.31.26.1 + 32.31.11.22.1 + 4.7.1 + 6.27.29.14.8.12.26.3.21.4.1 + 8.13.1 + 8.2.18.23.5.16.17.1 + 8.32.30.1 + 9.21.20.29.1 +(34 rows) + +SELECT * FROM ltreetest WHERE t ~ '23.*{1}.1' order by t asc; + t +--------- + 23.28.1 +(1 row) + +SELECT * FROM ltreetest WHERE t ~ '23.*.1' order by t asc; + t +--------------------------- + 23.17.22.1.23.4.29.32.4.1 + 23.28.1 + 23.3.32.21.5.14.10.17.1 +(3 rows) + +SELECT * FROM ltreetest WHERE t ~ '23.*.2' order by t asc; + t +------------------ + 23.20.12.16.15.2 +(1 row) + +SELECT * FROM ltreetest WHERE t ? '{23.*.1,23.*.2}' order by t asc; + t +--------------------------- + 23.17.22.1.23.4.29.32.4.1 + 23.20.12.16.15.2 + 23.28.1 + 23.3.32.21.5.14.10.17.1 +(4 rows) + +create unique index tstidx on ltreetest (t); +set enable_seqscan=off; +SELECT * FROM ltreetest WHERE t < '12.3' order by t asc; + t +---------------------------------- + + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 + 1.1.2 + 1.1.2.1 + 1.1.3 + 1.1.7.32.11.22 + 1.10.21 + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.10.5.22.13 + 1.11.10.19.6.1.26.17.2.22 + 1.12.25.26.22.8.15.23 + 1.13.16.27.11.16.30.2.9.18.4 + 1.14.3.7.3.17.2.29 + 1.15.17.6.28.25.24.31.27.9 + 1.16.8.18.14.16.21.25.6 + 1.18.29.30.22.14.3.20.15.21.20 + 1.19.22.11.14.7.32.23.19.14 + 1.20.18.25.3.24.25.10.9 + 1.20.22.26.2.6.11 + 1.21.28.4.23 + 1.22.19.24.8.11 + 1.22.29.5.16 + 1.25.7.9.26.17.31.20.13 + 1.26 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 1.28.19.8.25.6.20.27.29.27 + 1.28.3.22 + 1.29.18.1.21.12.13.27.32.15 + 1.3.15.11.11.25.24.21.19 + 1.30.18.31.12.25.4.19.28.12.15 + 1.30.31.31.20.16.7 + 1.31.3 + 1.4.14.32.14 + 1.8 + 1.9.18.10.1.26.22.16.17 + 10.11.25.2.24.18.18.21.6.26.21 + 10.12.23.22.23.22.20.17.17.9 + 10.12.9.6.6.26.14.8.23.1.25 + 10.13.12.8.4.8.11.30 + 10.13.22.1.8.30.9.24.1.2.1 + 10.15.16.3 + 10.16.18.9.27.2.29.32.24.13 + 10.16.19.7.15 + 10.18.12.27.24.30.32.7.11.5.13 + 10.2.17.26.16.7.19.6.23.3 + 10.20 + 10.22.1 + 10.22.30.16.2.21.17.13 + 10.26.27.23.4.31.11.25.29 + 10.26.30.15.1 + 10.27.7.24.26.11.31.20.29 + 10.28.22.29.13.19.6.7.6.14 + 10.28.7.16.31 + 10.29 + 10.29.26.4.27.17.11 + 10.3 + 10.3.19 + 10.31 + 10.31.25.31.24.16.17 + 10.32.14 + 10.5.23.5.32.9.18.5.30 + 10.5.5.15.29.2 + 10.7.9 + 10.8.20.11.12.23.22 + 11.1 + 11.1.3.28.30.21.24.14 + 11.10 + 11.10.22.18 + 11.11.11.4.23.21.25 + 11.11.9.30.15.29.15.18 + 11.12.6.21 + 11.14.21.24.10.7.29.23.24.28 + 11.15.11.19.29.10 + 11.16.16.28.14 + 11.17.10 + 11.17.17.24.11.23.17.17.18.10.22 + 11.18.4.8.3.13.14.28.18.31 + 11.19.23.3.6.11 + 11.2.27.3 + 11.21.13.9.19 + 11.21.16.27.16 + 11.22.28.8.12.23.25.15.21.28 + 11.29 + 11.3.15.28.22.8.14 + 11.30 + 11.30.20.15.18.32.1.18.25.26.8 + 11.32.18.31 + 11.6.11.29.4.5.24.6.26.12 + 11.7.31.15.22 + 11.8.18 + 12.1.1 + 12.1.28.22.25 + 12.10 + 12.10.11.9.10.31.4.16.31 + 12.11.17.1.2 + 12.11.20.20.29 + 12.13.16.17.29.27.16.14.9.19.9 + 12.13.5.31 + 12.14.20.8.28.4 + 12.15.10.17.18.13 + 12.16.13 + 12.16.2.4.15 + 12.17.10.7.17.16 + 12.18 + 12.2.4.28.21.30.24 + 12.21.15.27.24.15.8.24.24.26 + 12.21.20.20 + 12.22.20.4.12 + 12.23.3.19.29.15.12.6 + 12.24.29.32.32.29.2 + 12.25.32.2.27.3.3.16 + 12.27.23.32.1.1.9.29.13 + 12.27.30.12.24.2.20 + 12.28.12.24.28.15.5.12.30.13.21 + 12.29.17.2.20.29.1.11.19.8.12 + 12.29.26.18.4.21.28.8.13.3 +(123 rows) + +SELECT * FROM ltreetest WHERE t <= '12.3' order by t asc; + t +---------------------------------- + + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 + 1.1.2 + 1.1.2.1 + 1.1.3 + 1.1.7.32.11.22 + 1.10.21 + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.10.5.22.13 + 1.11.10.19.6.1.26.17.2.22 + 1.12.25.26.22.8.15.23 + 1.13.16.27.11.16.30.2.9.18.4 + 1.14.3.7.3.17.2.29 + 1.15.17.6.28.25.24.31.27.9 + 1.16.8.18.14.16.21.25.6 + 1.18.29.30.22.14.3.20.15.21.20 + 1.19.22.11.14.7.32.23.19.14 + 1.20.18.25.3.24.25.10.9 + 1.20.22.26.2.6.11 + 1.21.28.4.23 + 1.22.19.24.8.11 + 1.22.29.5.16 + 1.25.7.9.26.17.31.20.13 + 1.26 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 1.28.19.8.25.6.20.27.29.27 + 1.28.3.22 + 1.29.18.1.21.12.13.27.32.15 + 1.3.15.11.11.25.24.21.19 + 1.30.18.31.12.25.4.19.28.12.15 + 1.30.31.31.20.16.7 + 1.31.3 + 1.4.14.32.14 + 1.8 + 1.9.18.10.1.26.22.16.17 + 10.11.25.2.24.18.18.21.6.26.21 + 10.12.23.22.23.22.20.17.17.9 + 10.12.9.6.6.26.14.8.23.1.25 + 10.13.12.8.4.8.11.30 + 10.13.22.1.8.30.9.24.1.2.1 + 10.15.16.3 + 10.16.18.9.27.2.29.32.24.13 + 10.16.19.7.15 + 10.18.12.27.24.30.32.7.11.5.13 + 10.2.17.26.16.7.19.6.23.3 + 10.20 + 10.22.1 + 10.22.30.16.2.21.17.13 + 10.26.27.23.4.31.11.25.29 + 10.26.30.15.1 + 10.27.7.24.26.11.31.20.29 + 10.28.22.29.13.19.6.7.6.14 + 10.28.7.16.31 + 10.29 + 10.29.26.4.27.17.11 + 10.3 + 10.3.19 + 10.31 + 10.31.25.31.24.16.17 + 10.32.14 + 10.5.23.5.32.9.18.5.30 + 10.5.5.15.29.2 + 10.7.9 + 10.8.20.11.12.23.22 + 11.1 + 11.1.3.28.30.21.24.14 + 11.10 + 11.10.22.18 + 11.11.11.4.23.21.25 + 11.11.9.30.15.29.15.18 + 11.12.6.21 + 11.14.21.24.10.7.29.23.24.28 + 11.15.11.19.29.10 + 11.16.16.28.14 + 11.17.10 + 11.17.17.24.11.23.17.17.18.10.22 + 11.18.4.8.3.13.14.28.18.31 + 11.19.23.3.6.11 + 11.2.27.3 + 11.21.13.9.19 + 11.21.16.27.16 + 11.22.28.8.12.23.25.15.21.28 + 11.29 + 11.3.15.28.22.8.14 + 11.30 + 11.30.20.15.18.32.1.18.25.26.8 + 11.32.18.31 + 11.6.11.29.4.5.24.6.26.12 + 11.7.31.15.22 + 11.8.18 + 12.1.1 + 12.1.28.22.25 + 12.10 + 12.10.11.9.10.31.4.16.31 + 12.11.17.1.2 + 12.11.20.20.29 + 12.13.16.17.29.27.16.14.9.19.9 + 12.13.5.31 + 12.14.20.8.28.4 + 12.15.10.17.18.13 + 12.16.13 + 12.16.2.4.15 + 12.17.10.7.17.16 + 12.18 + 12.2.4.28.21.30.24 + 12.21.15.27.24.15.8.24.24.26 + 12.21.20.20 + 12.22.20.4.12 + 12.23.3.19.29.15.12.6 + 12.24.29.32.32.29.2 + 12.25.32.2.27.3.3.16 + 12.27.23.32.1.1.9.29.13 + 12.27.30.12.24.2.20 + 12.28.12.24.28.15.5.12.30.13.21 + 12.29.17.2.20.29.1.11.19.8.12 + 12.29.26.18.4.21.28.8.13.3 + 12.3 +(124 rows) + +SELECT * FROM ltreetest WHERE t = '12.3' order by t asc; + t +------ + 12.3 +(1 row) + +SELECT * FROM ltreetest WHERE t >= '12.3' order by t asc; + t +---------------------------------- + 12.3 + 12.4.10.17.4.10.23.3 + 12.4.12.13.25.30.30.8.9.12 + 12.4.24.6.1.13.5.20 + 12.4.26.23.25.5.15.7.16 + 12.6.14.23.19.21.9.12 + 12.7.16.8.21.22.2.16.18 + 12.7.28.26.14.21.18.31.5.15.11 + 13.1.6.17.28.9.15.30.1.27.14 + 13.12 + 13.14.13.10.28.26.9.18.27.21 + 13.16.1.27.18.18.19.6.14.4 + 13.16.4.28 + 13.17.7 + 13.19.2.6.23.19.9.7.21.8.16 + 13.24 + 13.25.10.25.8.16 + 13.26.17.3.2.19 + 13.28.12.6 + 13.28.14.2.8.18 + 13.28.9.3 + 13.3.20 + 13.3.8 + 13.30.24 + 13.32.15.32.26.14.32 + 13.7 + 13.8.15.3.7.31.5.10.15.30 + 13.8.20.9.21 + 13.8.23.13.11.18.24.21.11.24.10 + 13.9.9.27.31.11.25.9.27.22.13 + 14.1.11 + 14.1.15.25.27.23.25.26.28.10 + 14.10.11.30.5.7.6.24.9.30.26 + 14.11.25 + 14.12.31 + 14.13.9.13.11.5.5.2.2.32.12 + 14.14.25 + 14.15.31.29 + 14.16.6.29.26.13.14.16.25.26.8 + 14.17.7.30.8.25.26.4 + 14.19.20.13.27.2.2 + 14.19.26.15.22.23 + 14.19.30.6.4.10.10.10.22.25.11 + 14.2.14.11.12 + 14.21.22 + 14.21.5.28.3.32.24.14.25.31 + 14.21.6.5.26.9.32.16.25 + 14.23.31.5.5.15.17.12.17.7.3 + 14.24 + 14.26.25.4.12.26.8 + 14.27.29.23.4.1.17.32.6.25.22 + 14.29 + 14.3.17.1.14.15.21.4.26 + 14.30.13.5.26.9.22.23.14.10 + 14.30.2.21.15.16.13 + 14.30.23.3 + 14.4.19.27.28.24.19 + 14.4.23.4.23.22.11.6.26.5 + 14.5.13.19.25.12.32.9.13.16.12 + 14.6.10.29.25.26.20.24.24 + 14.8.15.30.7.29.27.31.4 + 14.9.15.21.21.31.1.29 + 15.1.6.31.30.13.32.9.10 + 15.1.8 + 15.10.30.1.4.12.8.20 + 15.11.26.1.30.6.23.5 + 15.17 + 15.17.2.32.7 + 15.21.22 + 15.21.23.30.9.25 + 15.23.26.20.27.7 + 15.25.31.11.4.22.16.7.11 + 15.26.24.31.16.15.17.22.8.30.3 + 15.28.24 + 15.28.30.19.31.6.2.2.31 + 15.29.25 + 15.29.32.16.29.12.20.32.13.20 + 15.3.31.9.27.14.9.8.14.6.32 + 15.30.17.5.32.28.2.18.27 + 15.31.11.27.19.19.20.5.5 + 15.4.15 + 15.5.1.31.28.10.8 + 15.6.19.3 + 15.7.3.14.23.19.26 + 15.7.5.12.7.9.3.28.26 + 15.8.10 + 15.8.3.15.27.14.29.28.6.5.25 + 15.9.11.20.22.15.11.13 + 15.9.8.20.27 + 16.13.19.11.18.13.17.17 + 16.13.2.19.14.29.31.30.23.15.12 + 16.13.26.18.9.29.11.17.1.24.26 + 16.14.3.17.17.26.12.19.19.30 + 16.16.28.24.11 + 16.18.23.6.31 + 16.19.17.30.30.5.17.24.27 + 16.2.14.3.26.11 + 16.20.29.26 + 16.21.13.1.4 + 16.23.30.12.31.31.19.14 + 16.24.3.30.15.22.31.2 + 16.24.7.25 + 16.27.8.17.14.17.21.29.14 + 16.28 + 16.29.6.23.13.28.31.6.19.26.15 + 16.30.10.7.29.4.9.21.22.13.26 + 16.31.12.27.25.9.32.29 + 16.5 + 16.5.10.2.18.8.15.12.32.25.10 + 16.5.12.5.15.12.24.25.3 + 16.5.14.21.32.17.23.3.4.26 + 16.5.23.17 + 16.5.6.12 + 16.8.29.7.21.2.3 + 16.9.14.28.6.21.31.31.26 + 16.9.29 + 16.9.32.14.3.7.8.7.21.22 + 17.1.12.20 + 17.10.17.22.20.25.14.13 + 17.11.17.4.8.26.26.20.6 + 17.13.14.29.27.27.13.12.15 + 17.13.19.31.12.18.10.15.14 + 17.13.8 + 17.14.7.3.2.18.20.23.18.5 + 17.17.14.28.6.30 + 17.19.1.22.11.7.22.1.14.28.11 + 17.22.12.10.30.11 + 17.24.15.27.3.32.4.22.20.6.24 + 17.24.30.6.32 + 17.25.10.13.21.5.7.22.2 + 17.25.2.13.10.27.13.1 + 17.25.26.23.32 + 17.26.18 + 17.27 + 17.29.21.10.18.8.16.26.18.21.26 + 17.29.31.8.24.10.18.27.17 + 17.3 + 17.5.3.15.17.13.5 + 17.7.26.30.18.23.4 + 17.8 + 17.8.31.32 + 17.9.32.31.21.31.23.17.10.32.9 + 18.13.6.12.26.26.26.29.18.20.1 + 18.13.9.3.18.15.2 + 18.15.14 + 18.17.6.16.6.10 + 18.18.19.16.14.16.21.10.25 + 18.18.5.11.7.4.25 + 18.19.11.20.13.13.11 + 18.19.12.20.18.17.15.32.18.5 + 18.21 + 18.24.21.17.11.26.28.22.21.18.10 + 18.27.11.27.9.16.7.6.22.26.27 + 18.29.13.24.18.3.12.18.12.12 + 18.29.5.1.10.21.2 + 18.30.11.17 + 18.30.18.31 + 18.31.26.18.6.15.18.11 + 18.31.32.28.1.4.24.24.12.25 + 18.31.32.29.22.1.31.11.28 + 18.4 + 18.4.14.29.3 + 18.5.6.31.5.15.15 + 18.6.2.2.24 + 18.6.26.2.13.9.6.11.10.11.16 + 18.7.10.27.17.24 + 18.7.3.17.13.5.31.6.31.25.29 + 18.9.21.2.31.8.32 + 18.9.26.7 + 19.10.26.19.5.21.30.23 + 19.10.4.30.32.4.12 + 19.10.8.10.4.19 + 19.11.10.18.14.13.7.7 + 19.11.29.13.15.27.12.15.14.12 + 19.12.20.24.32.13.11.23.26 + 19.12.26.24.29.3 + 19.12.30.2.21 + 19.15.26.19 + 19.16.26.2 + 19.16.31.31.29.12 + 19.17.12.15 + 19.17.13.12.32.16.3 + 19.19.25.22.11.6.15.3.2.19 + 19.2.26.21.16.11.2.2 + 19.2.9.29.6 + 19.20.25.7.27.28.27.17.9.3.1 + 19.22.21.13.27.13.15 + 19.22.29.32.1.21.26.24.23.17 + 19.26.24.27.6.24.16.27.32.29 + 19.26.32.13.1.12.30.26.22.25 + 19.3.12.12 + 19.3.23.4.4.21.23 + 19.30.18.11.32.14 + 19.30.27.26.21.7.18 + 19.31.14.25.5.8.21.11.13.20 + 19.5.20.3.4.2.3 + 19.6.13.14.22.13.9.29 + 19.6.24.32.30.13.6.25.8.28 + 19.7 + 19.7.29.31.3.20.7.21.25.27.29 + 19.9.32.23.13.24.1 + 2.1.12.19.29.28.3.31.28.28.10 + 2.1.3.30.24.17.9 + 2.10.10.4.20.1.12.13 + 2.10.28.1.17.19.32.28 + 2.11.32.25.23 + 2.12.14.28.16.21 + 2.12.30.22.12 + 2.13.9.23.21.2 + 2.13.9.28 + 2.14.10.4.17.17.8.4.27.20 + 2.14.12.13 + 2.15.14.20.30.26 + 2.15.18.21.5.21.4.7.30 + 2.16.3.7.22.18.29.20 + 2.19.4.1.15.7.8.9.17.29 + 2.2.18.18.3.3.18.8.10.8 + 2.22.19 + 2.24.4.5.24.32 + 2.24.5.3.4.10.27.26.17.28.16 + 2.27.15.14 + 2.28.5.17.6.32 + 2.30.26.10.14.31.18.2 + 2.31.25 + 2.32.10.13.12 + 2.32.8.28.24.20.9.24.25.8.9 + 2.4.25.32.16.22.26.13.17.18 + 2.6.15.26.23.26.24 + 2.8.13.12.17.23.16.7.11.23 + 2.9 + 20.1.24.3.30.31 + 20.13 + 20.14.11.2.10.14 + 20.15 + 20.17.14.7 + 20.17.18.21.1 + 20.18.24.14.12.13.9 + 20.20.32.29.24.5.5.26.22.32 + 20.20.7 + 20.22.10 + 20.23.29.5.7.30.13.14.22 + 20.23.7.11.11.31.18.16.3 + 20.24.14.15.4.21.12.27.4.12 + 20.25.22.19.22 + 20.28.22.7.10.28.27.22.14.16 + 20.29.18.16.2.21.23.11 + 20.3.1.8.8.30.20 + 20.30.17 + 20.30.28.15.17 + 20.30.9.9.14.12.29 + 20.31.13.12.19.2.26.16.16.22.28 + 20.32.5.1.3.20.3.30.27 + 20.32.9 + 20.4.1.16.31.3 + 20.4.27.31.1 + 20.5.4.9.31.14.26.6 + 20.6.26.3.30 + 20.6.3.26.7.29.28.4 + 20.8.19.14.16.7 + 20.9.29.32.13.7.23 + 21.1.4.9.9.31.24.21.3.29 + 21.10.20.9.3.16.9.10.20 + 21.14 + 21.14.13 + 21.14.22.29 + 21.14.25.20.13.31.14.20 + 21.15.18.18.30.3.20 + 21.15.31.24.29.24.26.12.20 + 21.17.18.32.7.8 + 21.17.27.23.15 + 21.17.31.10.31.13.9.26.6.14 + 21.18 + 21.18.2.1 + 21.18.30.19.24.24 + 21.20.24.25.6.26.23 + 21.20.28.19.27.9 + 21.21.10.27 + 21.22.31.24.27 + 21.23.13 + 21.23.17.8.23.11.8.1 + 21.28.17.22.10.27.4.20.2.32 + 21.28.24.23.3.11.7.12.22.32 + 21.30.19.6.28.1.32.2.14.14 + 21.31.31.25.5.30.26 + 21.32.13.21 + 21.32.13.22.3.13.31.23.14.12.9 + 21.4.11.18 + 21.4.22.20.24.28.6 + 21.5.11.18 + 21.5.17.19.15.25.18.21.24.9 + 21.6.22.28.12.23.11.22 + 21.7.23.9.16.5.18.14 + 21.7.7.11 + 21.8.9 + 21.9.27.22.32 + 21.9.32.1.27 + 22.10.12.23.9 + 22.10.16.8 + 22.10.18 + 22.10.27.19.29.20.29.3.12.14.25 + 22.11 + 22.12.22.28 + 22.13.22.21.25.17.8 + 22.13.22.8.30.32.10.24 + 22.15 + 22.16 + 22.16.25.18.25.7.24.29.14.8 + 22.17.24.14.21.15.12.18.17.25.11 + 22.17.30 + 22.17.4.2.22.17 + 22.17.7.30.13.24 + 22.17.9.11.25.15.3.9 + 22.18.20.23.15.9.12 + 22.19.20.5.2.20 + 22.19.21.11.6.8.29.24 + 22.19.5.22.20.31.23.24.14.24.4 + 22.20.30 + 22.21.32.15.8.29.5.12.10.29 + 22.22.10.30.5.15.25.21.19.11 + 22.22.27.6.27.15.5.18.21.28.9 + 22.23.18.18.9.8.23.7.23.23.16 + 22.23.22.30 + 22.23.25.28.5.27.9.9.24.31.10 + 22.24.22.25.15.23.13 + 22.25.4.28.9.20.12.13 + 22.26.1.28.9.9.31 + 22.26.32 + 22.28.20.6.32.32 + 22.29.18.32.13.12.22.31.17.22 + 22.29.29.11 + 22.3.6 + 22.30 + 22.30.31.24.23.22.5.20.28.1 + 22.31.2.32.32.11.26.23.19 + 22.31.21.13.13.26.11.5.19 + 22.32.6.6.3.8.24.6.25.29 + 22.8.20.1.10.28.6.27 + 22.9.15.19.12 + 23.1.23.18.12.29 + 23.10.13.32.14.20.16.11.14 + 23.10.5.26.12.4.20.4 + 23.12.1.5.32.25.8.24.1.25 + 23.12.11.11.15.16.22.31.32.5.8 + 23.12.19.25.16.23.22.6.29.4 + 23.12.32.22.19.1.22.4 + 23.14.12.30.18.4.16.18.7.7 + 23.14.30.27.28.26.26.23.8.32 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.17.28.31.28 + 23.17.32.15.23.16.25 + 23.19.17.31.29.13.1.12.5.25 + 23.2.22.7.32.3.27.6 + 23.20.12.16.15.2 + 23.20.24 + 23.20.8 + 23.22.10.1.14.24 + 23.22.23.14.31.32 + 23.23 + 23.24.11.31.10.31.18.28.13.18.6 + 23.24.16.32.13.29 + 23.25.23.11.7.23 + 23.27.27.16 + 23.27.6.26.22 + 23.28.1 + 23.28.20.25.30.24.15 + 23.28.3.30.15.31.32.3.21.9.19 + 23.3.20.24 + 23.3.32.21.5.14.10.17.1 + 23.31.27.16.8.30.20.27 + 23.32.5.25.19.9.15.17.15.11 + 23.5.5.17 + 23.5.7.12.11.23.10 + 23.6.27 + 23.8.13.22.21 + 24.1.10.20.28.18.6.27.20.30.26 + 24.1.29.32.14.15.32.6.15.22 + 24.10.10.31.4.29.9 + 24.10.8.25.16 + 24.11.5 + 24.12 + 24.13.1.8 + 24.15.15.17.22 + 24.16.27.10.9 + 24.17.24 + 24.17.31.20.12.9.19.29.18 + 24.18.16 + 24.2.26.24.14.15.31.23.17.26 + 24.2.6.7.16.7.28 + 24.20.23 + 24.21.14.25.11.3.20.6.6.16 + 24.23.24.4.15.25.17 + 24.23.29.8.24.11.21.10.28.14.27 + 24.24 + 24.25.7.27.30.8.26.17 + 24.27.14 + 24.27.18.32.14.9.11.28.9 + 24.28.13.26.8.8.31 + 24.28.32.21 + 24.3.23.25 + 24.31 + 24.31.2.13.5.23.18.16 + 24.31.8 + 24.32.17.23.24.19.23.9.20.18 + 24.32.27 + 24.9 + 24.9.15.1.14.29.6.4 + 24.9.27.16.20.21 + 24.9.8.12.29 + 25.10 + 25.10.29.3.6.21.3.31.13 + 25.10.4.28.3.31.19 + 25.11.24 + 25.14.5.32.25 + 25.15.11 + 25.16.9.6 + 25.17.18.17.27 + 25.17.18.30 + 25.17.2.20.20.3.29.21.3.12 + 25.17.9.16.17.31.23.29.24 + 25.18.8.3.23.23.5.9.6 + 25.19.27.2.9.20 + 25.2.11.20.8.6.22 + 25.2.3.15.11.19.5.28.25.14 + 25.21.8.17 + 25.22.2.25.6 + 25.24.2.32.14.18.16 + 25.24.29 + 25.28.3 + 25.28.30.24 + 25.29 + 25.3 + 25.30.1.4.24.11 + 25.31 + 25.32.24.24.28.15.16.10 + 25.4.32 + 25.4.4.1.13.32.26.20.20.3 + 25.5.30.7.16.12.21.12.11.16 + 25.6 + 25.6.12.16.1 + 25.7.3.21.31.12.28 + 25.9 + 25.9.1.5.9.11.25.4.11.27.32 + 25.9.10 + 26.11 + 26.12.27.2 + 26.13.4.7.13.11.3 + 26.14 + 26.14.5.32.10 + 26.16.12 + 26.16.12.3.27.9.28 + 26.17.9.13.4.25.32.2.24.9 + 26.18 + 26.18.32.20 + 26.19.3.14.8.28.31.10 + 26.24 + 26.24.9.12.11.15.31.2 + 26.25.10.10.13 + 26.25.24 + 26.26.22.21.14.11.29.19.14.24 + 26.28.14 + 26.31.11.23.3 + 26.31.16.18.22.13.32.23.9.20 + 26.31.6.8.29.8.24 + 26.31.7 + 26.32.21.31.27.12 + 26.32.8.12.30.19.24.8.6.1.10 + 26.5.29.7.28 + 26.7.22.3.18.21.11 + 26.7.5.8.11.9.22.1.6 + 26.8.28 + 26.9.17.1.18.19.1.11.18.29.3 + 26.9.20.12.22.22.32 + 27.1.11.3.25.9.6.6 + 27.11.14.17.24 + 27.11.15.9.24.31.18.4.1.30.20 + 27.12.4.2.29.22.15 + 27.15.15.15 + 27.16 + 27.17.15.7.28.20 + 27.17.17.19.24.9.14.20 + 27.17.3.18.2.13.18 + 27.18 + 27.18.10.4.22 + 27.19.20.1.31.29.5.22.26.3 + 27.2.10.4.25.14.2.15.4 + 27.21.27.5.13.30.17 + 27.21.28.24.7.2.24.23.8 + 27.22.11.13.21.25.5.1.27.21.27 + 27.23.2.32.11.21 + 27.23.20.30.7 + 27.24.11.31.21.6.29.17.24.18 + 27.25 + 27.26.29 + 27.27 + 27.27.25.10.31.10.21.22.21.16.12 + 27.27.30.11.15.24.9.7.4.30 + 27.29.1.5.30.6.22.16.23.2.28 + 27.3 + 27.3.3.11.21.4.25 + 27.30.12.11.20.15.11.13 + 27.31.2.16.29.6 + 27.32.26.21.31.17.32.32 + 27.4 + 27.4.15.14.19.6.12 + 27.4.17.17.32.8.16.15.17.13 + 27.5.15.1.15.16.21 + 27.5.22 + 27.6.13.24.21.27.28.22.3.7.4 + 28.1.3 + 28.11.11.30.20.11.32 + 28.11.27.21.14.16 + 28.14.24.26.6.15.16.32.25.13.8 + 28.14.32.29.2.3.4 + 28.15.18.27 + 28.15.25.7.13.6.19.2 + 28.17.26.9 + 28.18.6.22.13.8.25 + 28.2.27.1.20 + 28.20.8.9.9.28.30.29 + 28.23.2.30.3.8.1.15.15.14.13 + 28.25.10.25.19.15 + 28.25.11.22 + 28.25.29.4.13.5.6 + 28.26.25.7 + 28.26.26.6.31 + 28.26.4.22.13.20.32.27.15 + 28.27.24.14 + 28.28 + 28.30.24.16.17.28.2.13.10 + 28.31.10.28.22.26.16.15 + 28.4 + 28.5.12.9.2.27.11.11.2 + 28.5.13 + 28.6 + 28.6.11.6.15.22.12.6 + 28.6.8.22.25 + 28.8.21.15.16.28.4.16.26.8 + 28.9.3.16.17.21.23.30 + 29.1 + 29.1.2.14.14 + 29.1.7.26.25.11.22 + 29.10.12.17.12.16 + 29.10.17.11.28.12.18.5.19.15.21 + 29.11.20.22.27 + 29.14.12.9.17.5.32 + 29.14.31.25.7.32.23 + 29.15.29.8.31.26.1 + 29.20.1.11.21.16.1.2.14.28 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 29.25.29.16.32.11.15.25.5.22.3 + 29.25.30.15.21.3.25.26.26 + 29.26.25.14.24.18.2.13.23.29 + 29.27 + 29.27.13.29.10.2 + 29.27.13.9.28.29.19.13.29.31.27 + 29.27.5.22.26 + 29.27.7.7.3.11.14.26.21.11 + 29.28.9.15.8.27.31 + 29.29.17.31 + 29.29.18 + 29.3.15.17.12.29 + 29.3.17.17.18.32 + 29.30.21.8.16.23.32 + 29.30.7.31.22 + 29.32.13.4.1.16.20 + 29.5.18.27.3.21.18.6.14 + 29.5.32.20.11.7.13.24.17 + 29.6.12.31.20.23.32.20 + 29.9.25.27.15.16.32.26.6.32 + 3.1.13.22.24.14.12.31.3.4 + 3.1.14.8.9.16.30.22.20 + 3.10 + 3.10.27.4.5.6.19.12.28.12 + 3.10.4.5.28.11 + 3.11.18.21.5.20.30 + 3.11.32.11.22.3.7.17.8.13.23 + 3.13 + 3.14.1.14.17.28.29.16 + 3.14.11.15.21.32.2.15.13 + 3.14.30.5.32.22.29 + 3.15.2.23.22.2.16.14 + 3.18 + 3.18.18 + 3.18.8.22.7.28.32.31.3 + 3.19.11.6.5 + 3.20.16.13.29.20 + 3.20.19.10.17.27.3.6.22.23 + 3.21.16.24.23.12.16.32.3 + 3.21.6.13.12.18.25 + 3.22.18.1.5.14.9.6.14 + 3.25 + 3.26 + 3.26.32 + 3.27.18.8.4.21.6.32.30.7.5 + 3.29.19.2.24 + 3.29.32.26.8.10.25 + 3.3 + 3.32.2.29.3.32.28.11.29.30 + 3.4.22.19 + 3.5 + 3.6.24.21.20.32.3.4.26.5 + 3.9.11.23.32.26.24.28 + 3.9.25.26.7 + 30.12.28.2 + 30.12.6.30 + 30.12.9.25.24.6.7.24.29 + 30.15 + 30.16.14.9.5.4.10.7.31 + 30.16.3.21.10 + 30.17.2.25 + 30.17.25.3.31.11.3.4.1.10 + 30.17.4.5.13.6 + 30.18.30.16.29 + 30.2.17.8.14 + 30.20.3.2.5.15.8.7.17 + 30.22.29.21.19.14.3.2.6 + 30.23.10.1.10.7.22.28.18.11.17 + 30.23.2.13.14.15.29.19.4.12.24 + 30.24 + 30.24.23.25.32.18.22.12.29.9.22 + 30.24.32.15.14.10.11 + 30.25 + 30.25.17.17.10.29 + 30.25.24.22 + 30.25.8.24.6.29.31 + 30.27.8.6.11.19 + 30.3.16.26.7.27.26.9.27.21.18 + 30.30.17.5.30.21.19.5.22.22.14 + 30.31.13.9 + 30.32 + 30.4.30.11.13.23.14.24.11 + 30.5 + 30.6.4 + 30.8.18.5.20.6.15 + 30.8.9.14.25.30 + 30.9.24 + 31.13 + 31.13.9.1.5.12 + 31.17 + 31.17.2.30.11 + 31.18 + 31.18.25.1.14.29.25.5.22.30 + 31.18.27.15.20.29.29 + 31.18.32.11.7.25.20.5 + 31.21.14.20.1.22.2.5.3.27.12 + 31.21.22.14.8.21 + 31.24.26.18 + 31.28.32.4.31.4.7 + 31.29.18.26.1.26.17 + 31.29.4.29.24.30.30.32.10.23 + 31.30.12.20 + 31.30.23.7.7.24.32.10.11.1.31 + 31.32.12.26.31.32.14.23.28 + 31.4.7 + 31.5.6.4.8.29.3 + 31.7.14.2 + 31.9.3.5 + 32.1.21.1.16.29.21 + 32.1.23.20.14.12.23.5.32.15 + 32.1.24.29.22.5.9.24.18.3.13 + 32.1.31 + 32.15.20.28.5.1.23.4 + 32.16 + 32.17.8.24.2.14.5.4.22 + 32.19.20.24.23.31.8.32.16.29 + 32.2.11 + 32.24.11.8.12.23.22.19.11.17.18 + 32.24.29.6 + 32.25.16 + 32.25.3.6 + 32.27.13.6.7 + 32.27.18.7.3.4.2 + 32.28.1.32.28.10 + 32.29.24.31.25.6.9 + 32.3.12.2 + 32.3.23.7.2 + 32.3.5.9.17.15 + 32.30.18.17.1.14.12.18 + 32.31.11.22.1 + 32.31.26.19.13.29.4.25 + 32.4.19 + 32.6.13.8.32 + 32.6.15.26.14.15.3.19 + 32.6.3.2.12.5.28.1.25 + 32.6.31.31 + 32.6.8 + 32.6.9.26.16.4.4.29.7.11 + 32.8.29.18.31 + 32.8.5 + 4.1.24.24.28.24.18 + 4.10.28 + 4.11.19.17.2.22.20.18.13.32.15 + 4.11.22.4.19.24.4.28.6.8.22 + 4.13 + 4.13.22.11.9.13.27.15.7 + 4.14 + 4.14.10.19.16 + 4.14.16.14.1.8.1.22.17.10 + 4.14.17.12.20.17.1.22.3 + 4.14.32 + 4.15.20.23.12.16.2.16.17 + 4.16.22.19.24.21 + 4.16.7.25.21.7 + 4.18.29.9.16.10 + 4.19.16.15.5.2.25.8.28.14.2 + 4.2.16.13.16.11.19.10.10.25 + 4.2.2.32.24.25.31.3 + 4.2.6.20.7.8 + 4.21.28.5.16.29.5.21 + 4.21.9.1.2.14.8.17.13.26 + 4.22 + 4.22.17.10.19.9.8.19.28.3.9 + 4.22.7.19.25 + 4.25.12.10.15.9.18.9 + 4.26.2.2 + 4.26.23.6.19.31.10.4.22 + 4.26.5.26.21.28.17.24.25.23 + 4.27.32.18 + 4.3.20.27.9.1.18.30.12.5.19 + 4.3.6.27.22.23.10 + 4.30.8.20.19.9.30.24.11 + 4.31 + 4.5.9.4.15.19.8.26.17.26.3 + 4.7.1 + 4.9 + 5.1.5.31 + 5.10 + 5.10.2.11.21.9.19 + 5.10.3.9.23.30.23 + 5.12.2.20.1.24.25 + 5.13.23.19.28.26.27.6.1.22 + 5.13.23.4.9 + 5.14.27.15.11.17.3.10.27.25 + 5.14.29.2.23.16.20.22 + 5.15.10.3.23.13.32.23 + 5.15.16 + 5.18.9.25.31.21.22 + 5.19.1.26.20.6.20 + 5.2.32.19.13.29.12.13.31.29 + 5.20 + 5.21.27.13.14.11.2.16.20 + 5.23.31.18.24.32 + 5.24.24.9.32.26.31 + 5.24.25.15.27.30.20 + 5.24.4.31.3.16.25.17.13.26.11 + 5.27.16.3.30 + 5.27.21.1.29.29.28 + 5.27.28.26.14.15.6.20.1.31.13 + 5.27.32.21.5.1.11.14 + 5.3.17.29 + 5.3.29.9.22 + 5.31.8.1.5.13.21.28.29.19.2 + 5.4.8.25.12.27.2.29.28.3 + 5.5.12.31.23.13.17.22.20 + 5.8 + 5.8.17.30.15.8.19.29.30.11.6 + 5.9.19.6 + 6.1.8.6.30.29.30 + 6.10.25.12 + 6.11.11.5.16.8.14.12.9 + 6.11.31.23.12.8.30.14.27 + 6.13.31.5.7.26 + 6.14 + 6.17.10.10.7.9.27.8.29 + 6.17.26.25.27.11.10.9 + 6.18.1.4.18.23 + 6.19.29.11.2.32.21.15.32.9 + 6.19.3 + 6.19.6.4.9.11.32.17.17.3.15 + 6.2.32 + 6.20 + 6.20.14 + 6.21.30.7 + 6.22.12 + 6.25.17.32 + 6.26 + 6.26.29.10.21.28.20.19 + 6.27.26.1.20.24.6 + 6.27.29.14.8.12.26.3.21.4.1 + 6.29.32.13.30.3.16 + 6.29.6.13.14.24.10.4.14.28 + 6.5.27.19.13.26.1.18.9 + 6.6.22.8 + 6.7.25.16.13.21.7.20.25.12.4 + 6.7.7 + 6.8.7.20.2 + 6.9.1.10.10.22.6 + 6.9.29.17.4.32 + 7.10.17.21.11.29.17.25.19.4.29 + 7.11 + 7.12 + 7.12.1.10.6.17.29.24.24.4 + 7.12.23 + 7.13 + 7.13.15 + 7.14.22.29.30.14.25.1.9.26.25 + 7.16.20.17 + 7.19.10.12.31.1.27.13.19 + 7.19.12.3.21.19.18.5.2.14.10 + 7.19.6.17.15.26.21.9 + 7.21.8 + 7.23.1.24.29.13.31.19.23.17.7 + 7.23.15.32.28.27.2.2.26 + 7.26.18 + 7.27.20 + 7.30.19.25.23.15.14.29 + 7.30.5.10.10.5.30.14.9.18 + 7.31 + 7.31.2.28.15.11.17.18.19.23.6 + 7.31.4.20.17 + 7.32.10.3.30.12.14 + 7.5.28.8.17.26.31.10.15 + 7.7 + 7.7.22.24.17.32.17.25.28 + 7.7.25.22.22.26 + 8.1.29.18.22 + 8.10 + 8.11.20 + 8.12.4 + 8.13.1 + 8.13.14.11.11.29.22.4.4.10 + 8.13.6.12.18.7 + 8.13.9.31.20.20.24.7.23.31.28 + 8.14.19.18 + 8.16 + 8.16.1.16.28.6.3.22.6.23 + 8.16.20.24.20.6.10.21 + 8.16.30.29.19.22.28.24.2 + 8.16.6 + 8.17.25.26.15.25 + 8.17.9.15.21.28.1.7.1.3.6 + 8.2 + 8.2.18.23.5.16.17.1 + 8.21.17.3.6.3.18 + 8.21.8.23.4.18 + 8.22.32.17.16.28.31.23.22.9 + 8.24.11.13.25.19 + 8.25.20.3.15.24.7.4.24.5.30 + 8.26.29.13.7.25.31.28.3.32 + 8.27.3.4.12.26.16 + 8.29.6.3 + 8.3.18.13.30.20.27.26.17.28 + 8.3.3.25.25.15.7.13.21.18 + 8.31.22.27 + 8.32.30.1 + 8.5.24.9.29.32.31.30.13.9.7 + 8.5.30.29.9.31 + 8.6.6.5.8.8.12 + 8.9.21.16.29 + 8.9.22 + 8.9.25.25.26.30.31.31.2.32.7 + 9.10.19.18.15.11.22.32.32.14.9 + 9.10.32 + 9.14.27.31.26.21.25.3.20 + 9.16.2.16.22.24.17.31.14.21.17 + 9.17.13.31.7 + 9.18.23 + 9.18.30.11.29.32.7.19.2 + 9.19.7.13.13.25 + 9.2.10.4 + 9.2.4.27.26 + 9.21.14.19 + 9.21.20.29.1 + 9.21.28.8.12.15.3.13.10.11 + 9.22.10.15.5.15 + 9.23.21.22.5.29.15.21 + 9.26.1.16 + 9.28.10.26.14.26.15.14 + 9.28.24 + 9.28.30.1.6.25.17.9 + 9.3.3 + 9.3.31.18.12.3.9.29.10 + 9.30 + 9.31.23.19.5.10.16.4.30.24.5 + 9.31.4.14.31.10.17.5.2 + 9.5 + 9.5.9.3.23.9.25.14.1.29.28 + 9.6.9.21.6.11.29.13.29.20.32 + 9.7.31.11.8.23 + 9.8.23.2.20.16 + 9.9.13.9.14.27 +(883 rows) + +SELECT * FROM ltreetest WHERE t > '12.3' order by t asc; + t +---------------------------------- + 12.4.10.17.4.10.23.3 + 12.4.12.13.25.30.30.8.9.12 + 12.4.24.6.1.13.5.20 + 12.4.26.23.25.5.15.7.16 + 12.6.14.23.19.21.9.12 + 12.7.16.8.21.22.2.16.18 + 12.7.28.26.14.21.18.31.5.15.11 + 13.1.6.17.28.9.15.30.1.27.14 + 13.12 + 13.14.13.10.28.26.9.18.27.21 + 13.16.1.27.18.18.19.6.14.4 + 13.16.4.28 + 13.17.7 + 13.19.2.6.23.19.9.7.21.8.16 + 13.24 + 13.25.10.25.8.16 + 13.26.17.3.2.19 + 13.28.12.6 + 13.28.14.2.8.18 + 13.28.9.3 + 13.3.20 + 13.3.8 + 13.30.24 + 13.32.15.32.26.14.32 + 13.7 + 13.8.15.3.7.31.5.10.15.30 + 13.8.20.9.21 + 13.8.23.13.11.18.24.21.11.24.10 + 13.9.9.27.31.11.25.9.27.22.13 + 14.1.11 + 14.1.15.25.27.23.25.26.28.10 + 14.10.11.30.5.7.6.24.9.30.26 + 14.11.25 + 14.12.31 + 14.13.9.13.11.5.5.2.2.32.12 + 14.14.25 + 14.15.31.29 + 14.16.6.29.26.13.14.16.25.26.8 + 14.17.7.30.8.25.26.4 + 14.19.20.13.27.2.2 + 14.19.26.15.22.23 + 14.19.30.6.4.10.10.10.22.25.11 + 14.2.14.11.12 + 14.21.22 + 14.21.5.28.3.32.24.14.25.31 + 14.21.6.5.26.9.32.16.25 + 14.23.31.5.5.15.17.12.17.7.3 + 14.24 + 14.26.25.4.12.26.8 + 14.27.29.23.4.1.17.32.6.25.22 + 14.29 + 14.3.17.1.14.15.21.4.26 + 14.30.13.5.26.9.22.23.14.10 + 14.30.2.21.15.16.13 + 14.30.23.3 + 14.4.19.27.28.24.19 + 14.4.23.4.23.22.11.6.26.5 + 14.5.13.19.25.12.32.9.13.16.12 + 14.6.10.29.25.26.20.24.24 + 14.8.15.30.7.29.27.31.4 + 14.9.15.21.21.31.1.29 + 15.1.6.31.30.13.32.9.10 + 15.1.8 + 15.10.30.1.4.12.8.20 + 15.11.26.1.30.6.23.5 + 15.17 + 15.17.2.32.7 + 15.21.22 + 15.21.23.30.9.25 + 15.23.26.20.27.7 + 15.25.31.11.4.22.16.7.11 + 15.26.24.31.16.15.17.22.8.30.3 + 15.28.24 + 15.28.30.19.31.6.2.2.31 + 15.29.25 + 15.29.32.16.29.12.20.32.13.20 + 15.3.31.9.27.14.9.8.14.6.32 + 15.30.17.5.32.28.2.18.27 + 15.31.11.27.19.19.20.5.5 + 15.4.15 + 15.5.1.31.28.10.8 + 15.6.19.3 + 15.7.3.14.23.19.26 + 15.7.5.12.7.9.3.28.26 + 15.8.10 + 15.8.3.15.27.14.29.28.6.5.25 + 15.9.11.20.22.15.11.13 + 15.9.8.20.27 + 16.13.19.11.18.13.17.17 + 16.13.2.19.14.29.31.30.23.15.12 + 16.13.26.18.9.29.11.17.1.24.26 + 16.14.3.17.17.26.12.19.19.30 + 16.16.28.24.11 + 16.18.23.6.31 + 16.19.17.30.30.5.17.24.27 + 16.2.14.3.26.11 + 16.20.29.26 + 16.21.13.1.4 + 16.23.30.12.31.31.19.14 + 16.24.3.30.15.22.31.2 + 16.24.7.25 + 16.27.8.17.14.17.21.29.14 + 16.28 + 16.29.6.23.13.28.31.6.19.26.15 + 16.30.10.7.29.4.9.21.22.13.26 + 16.31.12.27.25.9.32.29 + 16.5 + 16.5.10.2.18.8.15.12.32.25.10 + 16.5.12.5.15.12.24.25.3 + 16.5.14.21.32.17.23.3.4.26 + 16.5.23.17 + 16.5.6.12 + 16.8.29.7.21.2.3 + 16.9.14.28.6.21.31.31.26 + 16.9.29 + 16.9.32.14.3.7.8.7.21.22 + 17.1.12.20 + 17.10.17.22.20.25.14.13 + 17.11.17.4.8.26.26.20.6 + 17.13.14.29.27.27.13.12.15 + 17.13.19.31.12.18.10.15.14 + 17.13.8 + 17.14.7.3.2.18.20.23.18.5 + 17.17.14.28.6.30 + 17.19.1.22.11.7.22.1.14.28.11 + 17.22.12.10.30.11 + 17.24.15.27.3.32.4.22.20.6.24 + 17.24.30.6.32 + 17.25.10.13.21.5.7.22.2 + 17.25.2.13.10.27.13.1 + 17.25.26.23.32 + 17.26.18 + 17.27 + 17.29.21.10.18.8.16.26.18.21.26 + 17.29.31.8.24.10.18.27.17 + 17.3 + 17.5.3.15.17.13.5 + 17.7.26.30.18.23.4 + 17.8 + 17.8.31.32 + 17.9.32.31.21.31.23.17.10.32.9 + 18.13.6.12.26.26.26.29.18.20.1 + 18.13.9.3.18.15.2 + 18.15.14 + 18.17.6.16.6.10 + 18.18.19.16.14.16.21.10.25 + 18.18.5.11.7.4.25 + 18.19.11.20.13.13.11 + 18.19.12.20.18.17.15.32.18.5 + 18.21 + 18.24.21.17.11.26.28.22.21.18.10 + 18.27.11.27.9.16.7.6.22.26.27 + 18.29.13.24.18.3.12.18.12.12 + 18.29.5.1.10.21.2 + 18.30.11.17 + 18.30.18.31 + 18.31.26.18.6.15.18.11 + 18.31.32.28.1.4.24.24.12.25 + 18.31.32.29.22.1.31.11.28 + 18.4 + 18.4.14.29.3 + 18.5.6.31.5.15.15 + 18.6.2.2.24 + 18.6.26.2.13.9.6.11.10.11.16 + 18.7.10.27.17.24 + 18.7.3.17.13.5.31.6.31.25.29 + 18.9.21.2.31.8.32 + 18.9.26.7 + 19.10.26.19.5.21.30.23 + 19.10.4.30.32.4.12 + 19.10.8.10.4.19 + 19.11.10.18.14.13.7.7 + 19.11.29.13.15.27.12.15.14.12 + 19.12.20.24.32.13.11.23.26 + 19.12.26.24.29.3 + 19.12.30.2.21 + 19.15.26.19 + 19.16.26.2 + 19.16.31.31.29.12 + 19.17.12.15 + 19.17.13.12.32.16.3 + 19.19.25.22.11.6.15.3.2.19 + 19.2.26.21.16.11.2.2 + 19.2.9.29.6 + 19.20.25.7.27.28.27.17.9.3.1 + 19.22.21.13.27.13.15 + 19.22.29.32.1.21.26.24.23.17 + 19.26.24.27.6.24.16.27.32.29 + 19.26.32.13.1.12.30.26.22.25 + 19.3.12.12 + 19.3.23.4.4.21.23 + 19.30.18.11.32.14 + 19.30.27.26.21.7.18 + 19.31.14.25.5.8.21.11.13.20 + 19.5.20.3.4.2.3 + 19.6.13.14.22.13.9.29 + 19.6.24.32.30.13.6.25.8.28 + 19.7 + 19.7.29.31.3.20.7.21.25.27.29 + 19.9.32.23.13.24.1 + 2.1.12.19.29.28.3.31.28.28.10 + 2.1.3.30.24.17.9 + 2.10.10.4.20.1.12.13 + 2.10.28.1.17.19.32.28 + 2.11.32.25.23 + 2.12.14.28.16.21 + 2.12.30.22.12 + 2.13.9.23.21.2 + 2.13.9.28 + 2.14.10.4.17.17.8.4.27.20 + 2.14.12.13 + 2.15.14.20.30.26 + 2.15.18.21.5.21.4.7.30 + 2.16.3.7.22.18.29.20 + 2.19.4.1.15.7.8.9.17.29 + 2.2.18.18.3.3.18.8.10.8 + 2.22.19 + 2.24.4.5.24.32 + 2.24.5.3.4.10.27.26.17.28.16 + 2.27.15.14 + 2.28.5.17.6.32 + 2.30.26.10.14.31.18.2 + 2.31.25 + 2.32.10.13.12 + 2.32.8.28.24.20.9.24.25.8.9 + 2.4.25.32.16.22.26.13.17.18 + 2.6.15.26.23.26.24 + 2.8.13.12.17.23.16.7.11.23 + 2.9 + 20.1.24.3.30.31 + 20.13 + 20.14.11.2.10.14 + 20.15 + 20.17.14.7 + 20.17.18.21.1 + 20.18.24.14.12.13.9 + 20.20.32.29.24.5.5.26.22.32 + 20.20.7 + 20.22.10 + 20.23.29.5.7.30.13.14.22 + 20.23.7.11.11.31.18.16.3 + 20.24.14.15.4.21.12.27.4.12 + 20.25.22.19.22 + 20.28.22.7.10.28.27.22.14.16 + 20.29.18.16.2.21.23.11 + 20.3.1.8.8.30.20 + 20.30.17 + 20.30.28.15.17 + 20.30.9.9.14.12.29 + 20.31.13.12.19.2.26.16.16.22.28 + 20.32.5.1.3.20.3.30.27 + 20.32.9 + 20.4.1.16.31.3 + 20.4.27.31.1 + 20.5.4.9.31.14.26.6 + 20.6.26.3.30 + 20.6.3.26.7.29.28.4 + 20.8.19.14.16.7 + 20.9.29.32.13.7.23 + 21.1.4.9.9.31.24.21.3.29 + 21.10.20.9.3.16.9.10.20 + 21.14 + 21.14.13 + 21.14.22.29 + 21.14.25.20.13.31.14.20 + 21.15.18.18.30.3.20 + 21.15.31.24.29.24.26.12.20 + 21.17.18.32.7.8 + 21.17.27.23.15 + 21.17.31.10.31.13.9.26.6.14 + 21.18 + 21.18.2.1 + 21.18.30.19.24.24 + 21.20.24.25.6.26.23 + 21.20.28.19.27.9 + 21.21.10.27 + 21.22.31.24.27 + 21.23.13 + 21.23.17.8.23.11.8.1 + 21.28.17.22.10.27.4.20.2.32 + 21.28.24.23.3.11.7.12.22.32 + 21.30.19.6.28.1.32.2.14.14 + 21.31.31.25.5.30.26 + 21.32.13.21 + 21.32.13.22.3.13.31.23.14.12.9 + 21.4.11.18 + 21.4.22.20.24.28.6 + 21.5.11.18 + 21.5.17.19.15.25.18.21.24.9 + 21.6.22.28.12.23.11.22 + 21.7.23.9.16.5.18.14 + 21.7.7.11 + 21.8.9 + 21.9.27.22.32 + 21.9.32.1.27 + 22.10.12.23.9 + 22.10.16.8 + 22.10.18 + 22.10.27.19.29.20.29.3.12.14.25 + 22.11 + 22.12.22.28 + 22.13.22.21.25.17.8 + 22.13.22.8.30.32.10.24 + 22.15 + 22.16 + 22.16.25.18.25.7.24.29.14.8 + 22.17.24.14.21.15.12.18.17.25.11 + 22.17.30 + 22.17.4.2.22.17 + 22.17.7.30.13.24 + 22.17.9.11.25.15.3.9 + 22.18.20.23.15.9.12 + 22.19.20.5.2.20 + 22.19.21.11.6.8.29.24 + 22.19.5.22.20.31.23.24.14.24.4 + 22.20.30 + 22.21.32.15.8.29.5.12.10.29 + 22.22.10.30.5.15.25.21.19.11 + 22.22.27.6.27.15.5.18.21.28.9 + 22.23.18.18.9.8.23.7.23.23.16 + 22.23.22.30 + 22.23.25.28.5.27.9.9.24.31.10 + 22.24.22.25.15.23.13 + 22.25.4.28.9.20.12.13 + 22.26.1.28.9.9.31 + 22.26.32 + 22.28.20.6.32.32 + 22.29.18.32.13.12.22.31.17.22 + 22.29.29.11 + 22.3.6 + 22.30 + 22.30.31.24.23.22.5.20.28.1 + 22.31.2.32.32.11.26.23.19 + 22.31.21.13.13.26.11.5.19 + 22.32.6.6.3.8.24.6.25.29 + 22.8.20.1.10.28.6.27 + 22.9.15.19.12 + 23.1.23.18.12.29 + 23.10.13.32.14.20.16.11.14 + 23.10.5.26.12.4.20.4 + 23.12.1.5.32.25.8.24.1.25 + 23.12.11.11.15.16.22.31.32.5.8 + 23.12.19.25.16.23.22.6.29.4 + 23.12.32.22.19.1.22.4 + 23.14.12.30.18.4.16.18.7.7 + 23.14.30.27.28.26.26.23.8.32 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.17.28.31.28 + 23.17.32.15.23.16.25 + 23.19.17.31.29.13.1.12.5.25 + 23.2.22.7.32.3.27.6 + 23.20.12.16.15.2 + 23.20.24 + 23.20.8 + 23.22.10.1.14.24 + 23.22.23.14.31.32 + 23.23 + 23.24.11.31.10.31.18.28.13.18.6 + 23.24.16.32.13.29 + 23.25.23.11.7.23 + 23.27.27.16 + 23.27.6.26.22 + 23.28.1 + 23.28.20.25.30.24.15 + 23.28.3.30.15.31.32.3.21.9.19 + 23.3.20.24 + 23.3.32.21.5.14.10.17.1 + 23.31.27.16.8.30.20.27 + 23.32.5.25.19.9.15.17.15.11 + 23.5.5.17 + 23.5.7.12.11.23.10 + 23.6.27 + 23.8.13.22.21 + 24.1.10.20.28.18.6.27.20.30.26 + 24.1.29.32.14.15.32.6.15.22 + 24.10.10.31.4.29.9 + 24.10.8.25.16 + 24.11.5 + 24.12 + 24.13.1.8 + 24.15.15.17.22 + 24.16.27.10.9 + 24.17.24 + 24.17.31.20.12.9.19.29.18 + 24.18.16 + 24.2.26.24.14.15.31.23.17.26 + 24.2.6.7.16.7.28 + 24.20.23 + 24.21.14.25.11.3.20.6.6.16 + 24.23.24.4.15.25.17 + 24.23.29.8.24.11.21.10.28.14.27 + 24.24 + 24.25.7.27.30.8.26.17 + 24.27.14 + 24.27.18.32.14.9.11.28.9 + 24.28.13.26.8.8.31 + 24.28.32.21 + 24.3.23.25 + 24.31 + 24.31.2.13.5.23.18.16 + 24.31.8 + 24.32.17.23.24.19.23.9.20.18 + 24.32.27 + 24.9 + 24.9.15.1.14.29.6.4 + 24.9.27.16.20.21 + 24.9.8.12.29 + 25.10 + 25.10.29.3.6.21.3.31.13 + 25.10.4.28.3.31.19 + 25.11.24 + 25.14.5.32.25 + 25.15.11 + 25.16.9.6 + 25.17.18.17.27 + 25.17.18.30 + 25.17.2.20.20.3.29.21.3.12 + 25.17.9.16.17.31.23.29.24 + 25.18.8.3.23.23.5.9.6 + 25.19.27.2.9.20 + 25.2.11.20.8.6.22 + 25.2.3.15.11.19.5.28.25.14 + 25.21.8.17 + 25.22.2.25.6 + 25.24.2.32.14.18.16 + 25.24.29 + 25.28.3 + 25.28.30.24 + 25.29 + 25.3 + 25.30.1.4.24.11 + 25.31 + 25.32.24.24.28.15.16.10 + 25.4.32 + 25.4.4.1.13.32.26.20.20.3 + 25.5.30.7.16.12.21.12.11.16 + 25.6 + 25.6.12.16.1 + 25.7.3.21.31.12.28 + 25.9 + 25.9.1.5.9.11.25.4.11.27.32 + 25.9.10 + 26.11 + 26.12.27.2 + 26.13.4.7.13.11.3 + 26.14 + 26.14.5.32.10 + 26.16.12 + 26.16.12.3.27.9.28 + 26.17.9.13.4.25.32.2.24.9 + 26.18 + 26.18.32.20 + 26.19.3.14.8.28.31.10 + 26.24 + 26.24.9.12.11.15.31.2 + 26.25.10.10.13 + 26.25.24 + 26.26.22.21.14.11.29.19.14.24 + 26.28.14 + 26.31.11.23.3 + 26.31.16.18.22.13.32.23.9.20 + 26.31.6.8.29.8.24 + 26.31.7 + 26.32.21.31.27.12 + 26.32.8.12.30.19.24.8.6.1.10 + 26.5.29.7.28 + 26.7.22.3.18.21.11 + 26.7.5.8.11.9.22.1.6 + 26.8.28 + 26.9.17.1.18.19.1.11.18.29.3 + 26.9.20.12.22.22.32 + 27.1.11.3.25.9.6.6 + 27.11.14.17.24 + 27.11.15.9.24.31.18.4.1.30.20 + 27.12.4.2.29.22.15 + 27.15.15.15 + 27.16 + 27.17.15.7.28.20 + 27.17.17.19.24.9.14.20 + 27.17.3.18.2.13.18 + 27.18 + 27.18.10.4.22 + 27.19.20.1.31.29.5.22.26.3 + 27.2.10.4.25.14.2.15.4 + 27.21.27.5.13.30.17 + 27.21.28.24.7.2.24.23.8 + 27.22.11.13.21.25.5.1.27.21.27 + 27.23.2.32.11.21 + 27.23.20.30.7 + 27.24.11.31.21.6.29.17.24.18 + 27.25 + 27.26.29 + 27.27 + 27.27.25.10.31.10.21.22.21.16.12 + 27.27.30.11.15.24.9.7.4.30 + 27.29.1.5.30.6.22.16.23.2.28 + 27.3 + 27.3.3.11.21.4.25 + 27.30.12.11.20.15.11.13 + 27.31.2.16.29.6 + 27.32.26.21.31.17.32.32 + 27.4 + 27.4.15.14.19.6.12 + 27.4.17.17.32.8.16.15.17.13 + 27.5.15.1.15.16.21 + 27.5.22 + 27.6.13.24.21.27.28.22.3.7.4 + 28.1.3 + 28.11.11.30.20.11.32 + 28.11.27.21.14.16 + 28.14.24.26.6.15.16.32.25.13.8 + 28.14.32.29.2.3.4 + 28.15.18.27 + 28.15.25.7.13.6.19.2 + 28.17.26.9 + 28.18.6.22.13.8.25 + 28.2.27.1.20 + 28.20.8.9.9.28.30.29 + 28.23.2.30.3.8.1.15.15.14.13 + 28.25.10.25.19.15 + 28.25.11.22 + 28.25.29.4.13.5.6 + 28.26.25.7 + 28.26.26.6.31 + 28.26.4.22.13.20.32.27.15 + 28.27.24.14 + 28.28 + 28.30.24.16.17.28.2.13.10 + 28.31.10.28.22.26.16.15 + 28.4 + 28.5.12.9.2.27.11.11.2 + 28.5.13 + 28.6 + 28.6.11.6.15.22.12.6 + 28.6.8.22.25 + 28.8.21.15.16.28.4.16.26.8 + 28.9.3.16.17.21.23.30 + 29.1 + 29.1.2.14.14 + 29.1.7.26.25.11.22 + 29.10.12.17.12.16 + 29.10.17.11.28.12.18.5.19.15.21 + 29.11.20.22.27 + 29.14.12.9.17.5.32 + 29.14.31.25.7.32.23 + 29.15.29.8.31.26.1 + 29.20.1.11.21.16.1.2.14.28 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 29.25.29.16.32.11.15.25.5.22.3 + 29.25.30.15.21.3.25.26.26 + 29.26.25.14.24.18.2.13.23.29 + 29.27 + 29.27.13.29.10.2 + 29.27.13.9.28.29.19.13.29.31.27 + 29.27.5.22.26 + 29.27.7.7.3.11.14.26.21.11 + 29.28.9.15.8.27.31 + 29.29.17.31 + 29.29.18 + 29.3.15.17.12.29 + 29.3.17.17.18.32 + 29.30.21.8.16.23.32 + 29.30.7.31.22 + 29.32.13.4.1.16.20 + 29.5.18.27.3.21.18.6.14 + 29.5.32.20.11.7.13.24.17 + 29.6.12.31.20.23.32.20 + 29.9.25.27.15.16.32.26.6.32 + 3.1.13.22.24.14.12.31.3.4 + 3.1.14.8.9.16.30.22.20 + 3.10 + 3.10.27.4.5.6.19.12.28.12 + 3.10.4.5.28.11 + 3.11.18.21.5.20.30 + 3.11.32.11.22.3.7.17.8.13.23 + 3.13 + 3.14.1.14.17.28.29.16 + 3.14.11.15.21.32.2.15.13 + 3.14.30.5.32.22.29 + 3.15.2.23.22.2.16.14 + 3.18 + 3.18.18 + 3.18.8.22.7.28.32.31.3 + 3.19.11.6.5 + 3.20.16.13.29.20 + 3.20.19.10.17.27.3.6.22.23 + 3.21.16.24.23.12.16.32.3 + 3.21.6.13.12.18.25 + 3.22.18.1.5.14.9.6.14 + 3.25 + 3.26 + 3.26.32 + 3.27.18.8.4.21.6.32.30.7.5 + 3.29.19.2.24 + 3.29.32.26.8.10.25 + 3.3 + 3.32.2.29.3.32.28.11.29.30 + 3.4.22.19 + 3.5 + 3.6.24.21.20.32.3.4.26.5 + 3.9.11.23.32.26.24.28 + 3.9.25.26.7 + 30.12.28.2 + 30.12.6.30 + 30.12.9.25.24.6.7.24.29 + 30.15 + 30.16.14.9.5.4.10.7.31 + 30.16.3.21.10 + 30.17.2.25 + 30.17.25.3.31.11.3.4.1.10 + 30.17.4.5.13.6 + 30.18.30.16.29 + 30.2.17.8.14 + 30.20.3.2.5.15.8.7.17 + 30.22.29.21.19.14.3.2.6 + 30.23.10.1.10.7.22.28.18.11.17 + 30.23.2.13.14.15.29.19.4.12.24 + 30.24 + 30.24.23.25.32.18.22.12.29.9.22 + 30.24.32.15.14.10.11 + 30.25 + 30.25.17.17.10.29 + 30.25.24.22 + 30.25.8.24.6.29.31 + 30.27.8.6.11.19 + 30.3.16.26.7.27.26.9.27.21.18 + 30.30.17.5.30.21.19.5.22.22.14 + 30.31.13.9 + 30.32 + 30.4.30.11.13.23.14.24.11 + 30.5 + 30.6.4 + 30.8.18.5.20.6.15 + 30.8.9.14.25.30 + 30.9.24 + 31.13 + 31.13.9.1.5.12 + 31.17 + 31.17.2.30.11 + 31.18 + 31.18.25.1.14.29.25.5.22.30 + 31.18.27.15.20.29.29 + 31.18.32.11.7.25.20.5 + 31.21.14.20.1.22.2.5.3.27.12 + 31.21.22.14.8.21 + 31.24.26.18 + 31.28.32.4.31.4.7 + 31.29.18.26.1.26.17 + 31.29.4.29.24.30.30.32.10.23 + 31.30.12.20 + 31.30.23.7.7.24.32.10.11.1.31 + 31.32.12.26.31.32.14.23.28 + 31.4.7 + 31.5.6.4.8.29.3 + 31.7.14.2 + 31.9.3.5 + 32.1.21.1.16.29.21 + 32.1.23.20.14.12.23.5.32.15 + 32.1.24.29.22.5.9.24.18.3.13 + 32.1.31 + 32.15.20.28.5.1.23.4 + 32.16 + 32.17.8.24.2.14.5.4.22 + 32.19.20.24.23.31.8.32.16.29 + 32.2.11 + 32.24.11.8.12.23.22.19.11.17.18 + 32.24.29.6 + 32.25.16 + 32.25.3.6 + 32.27.13.6.7 + 32.27.18.7.3.4.2 + 32.28.1.32.28.10 + 32.29.24.31.25.6.9 + 32.3.12.2 + 32.3.23.7.2 + 32.3.5.9.17.15 + 32.30.18.17.1.14.12.18 + 32.31.11.22.1 + 32.31.26.19.13.29.4.25 + 32.4.19 + 32.6.13.8.32 + 32.6.15.26.14.15.3.19 + 32.6.3.2.12.5.28.1.25 + 32.6.31.31 + 32.6.8 + 32.6.9.26.16.4.4.29.7.11 + 32.8.29.18.31 + 32.8.5 + 4.1.24.24.28.24.18 + 4.10.28 + 4.11.19.17.2.22.20.18.13.32.15 + 4.11.22.4.19.24.4.28.6.8.22 + 4.13 + 4.13.22.11.9.13.27.15.7 + 4.14 + 4.14.10.19.16 + 4.14.16.14.1.8.1.22.17.10 + 4.14.17.12.20.17.1.22.3 + 4.14.32 + 4.15.20.23.12.16.2.16.17 + 4.16.22.19.24.21 + 4.16.7.25.21.7 + 4.18.29.9.16.10 + 4.19.16.15.5.2.25.8.28.14.2 + 4.2.16.13.16.11.19.10.10.25 + 4.2.2.32.24.25.31.3 + 4.2.6.20.7.8 + 4.21.28.5.16.29.5.21 + 4.21.9.1.2.14.8.17.13.26 + 4.22 + 4.22.17.10.19.9.8.19.28.3.9 + 4.22.7.19.25 + 4.25.12.10.15.9.18.9 + 4.26.2.2 + 4.26.23.6.19.31.10.4.22 + 4.26.5.26.21.28.17.24.25.23 + 4.27.32.18 + 4.3.20.27.9.1.18.30.12.5.19 + 4.3.6.27.22.23.10 + 4.30.8.20.19.9.30.24.11 + 4.31 + 4.5.9.4.15.19.8.26.17.26.3 + 4.7.1 + 4.9 + 5.1.5.31 + 5.10 + 5.10.2.11.21.9.19 + 5.10.3.9.23.30.23 + 5.12.2.20.1.24.25 + 5.13.23.19.28.26.27.6.1.22 + 5.13.23.4.9 + 5.14.27.15.11.17.3.10.27.25 + 5.14.29.2.23.16.20.22 + 5.15.10.3.23.13.32.23 + 5.15.16 + 5.18.9.25.31.21.22 + 5.19.1.26.20.6.20 + 5.2.32.19.13.29.12.13.31.29 + 5.20 + 5.21.27.13.14.11.2.16.20 + 5.23.31.18.24.32 + 5.24.24.9.32.26.31 + 5.24.25.15.27.30.20 + 5.24.4.31.3.16.25.17.13.26.11 + 5.27.16.3.30 + 5.27.21.1.29.29.28 + 5.27.28.26.14.15.6.20.1.31.13 + 5.27.32.21.5.1.11.14 + 5.3.17.29 + 5.3.29.9.22 + 5.31.8.1.5.13.21.28.29.19.2 + 5.4.8.25.12.27.2.29.28.3 + 5.5.12.31.23.13.17.22.20 + 5.8 + 5.8.17.30.15.8.19.29.30.11.6 + 5.9.19.6 + 6.1.8.6.30.29.30 + 6.10.25.12 + 6.11.11.5.16.8.14.12.9 + 6.11.31.23.12.8.30.14.27 + 6.13.31.5.7.26 + 6.14 + 6.17.10.10.7.9.27.8.29 + 6.17.26.25.27.11.10.9 + 6.18.1.4.18.23 + 6.19.29.11.2.32.21.15.32.9 + 6.19.3 + 6.19.6.4.9.11.32.17.17.3.15 + 6.2.32 + 6.20 + 6.20.14 + 6.21.30.7 + 6.22.12 + 6.25.17.32 + 6.26 + 6.26.29.10.21.28.20.19 + 6.27.26.1.20.24.6 + 6.27.29.14.8.12.26.3.21.4.1 + 6.29.32.13.30.3.16 + 6.29.6.13.14.24.10.4.14.28 + 6.5.27.19.13.26.1.18.9 + 6.6.22.8 + 6.7.25.16.13.21.7.20.25.12.4 + 6.7.7 + 6.8.7.20.2 + 6.9.1.10.10.22.6 + 6.9.29.17.4.32 + 7.10.17.21.11.29.17.25.19.4.29 + 7.11 + 7.12 + 7.12.1.10.6.17.29.24.24.4 + 7.12.23 + 7.13 + 7.13.15 + 7.14.22.29.30.14.25.1.9.26.25 + 7.16.20.17 + 7.19.10.12.31.1.27.13.19 + 7.19.12.3.21.19.18.5.2.14.10 + 7.19.6.17.15.26.21.9 + 7.21.8 + 7.23.1.24.29.13.31.19.23.17.7 + 7.23.15.32.28.27.2.2.26 + 7.26.18 + 7.27.20 + 7.30.19.25.23.15.14.29 + 7.30.5.10.10.5.30.14.9.18 + 7.31 + 7.31.2.28.15.11.17.18.19.23.6 + 7.31.4.20.17 + 7.32.10.3.30.12.14 + 7.5.28.8.17.26.31.10.15 + 7.7 + 7.7.22.24.17.32.17.25.28 + 7.7.25.22.22.26 + 8.1.29.18.22 + 8.10 + 8.11.20 + 8.12.4 + 8.13.1 + 8.13.14.11.11.29.22.4.4.10 + 8.13.6.12.18.7 + 8.13.9.31.20.20.24.7.23.31.28 + 8.14.19.18 + 8.16 + 8.16.1.16.28.6.3.22.6.23 + 8.16.20.24.20.6.10.21 + 8.16.30.29.19.22.28.24.2 + 8.16.6 + 8.17.25.26.15.25 + 8.17.9.15.21.28.1.7.1.3.6 + 8.2 + 8.2.18.23.5.16.17.1 + 8.21.17.3.6.3.18 + 8.21.8.23.4.18 + 8.22.32.17.16.28.31.23.22.9 + 8.24.11.13.25.19 + 8.25.20.3.15.24.7.4.24.5.30 + 8.26.29.13.7.25.31.28.3.32 + 8.27.3.4.12.26.16 + 8.29.6.3 + 8.3.18.13.30.20.27.26.17.28 + 8.3.3.25.25.15.7.13.21.18 + 8.31.22.27 + 8.32.30.1 + 8.5.24.9.29.32.31.30.13.9.7 + 8.5.30.29.9.31 + 8.6.6.5.8.8.12 + 8.9.21.16.29 + 8.9.22 + 8.9.25.25.26.30.31.31.2.32.7 + 9.10.19.18.15.11.22.32.32.14.9 + 9.10.32 + 9.14.27.31.26.21.25.3.20 + 9.16.2.16.22.24.17.31.14.21.17 + 9.17.13.31.7 + 9.18.23 + 9.18.30.11.29.32.7.19.2 + 9.19.7.13.13.25 + 9.2.10.4 + 9.2.4.27.26 + 9.21.14.19 + 9.21.20.29.1 + 9.21.28.8.12.15.3.13.10.11 + 9.22.10.15.5.15 + 9.23.21.22.5.29.15.21 + 9.26.1.16 + 9.28.10.26.14.26.15.14 + 9.28.24 + 9.28.30.1.6.25.17.9 + 9.3.3 + 9.3.31.18.12.3.9.29.10 + 9.30 + 9.31.23.19.5.10.16.4.30.24.5 + 9.31.4.14.31.10.17.5.2 + 9.5 + 9.5.9.3.23.9.25.14.1.29.28 + 9.6.9.21.6.11.29.13.29.20.32 + 9.7.31.11.8.23 + 9.8.23.2.20.16 + 9.9.13.9.14.27 +(882 rows) + +drop index tstidx; +create index tstidx on ltreetest using gist (t); +set enable_seqscan=off; +SELECT * FROM ltreetest WHERE t < '12.3' order by t asc; + t +---------------------------------- + + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 + 1.1.2 + 1.1.2.1 + 1.1.3 + 1.1.7.32.11.22 + 1.10.21 + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.10.5.22.13 + 1.11.10.19.6.1.26.17.2.22 + 1.12.25.26.22.8.15.23 + 1.13.16.27.11.16.30.2.9.18.4 + 1.14.3.7.3.17.2.29 + 1.15.17.6.28.25.24.31.27.9 + 1.16.8.18.14.16.21.25.6 + 1.18.29.30.22.14.3.20.15.21.20 + 1.19.22.11.14.7.32.23.19.14 + 1.20.18.25.3.24.25.10.9 + 1.20.22.26.2.6.11 + 1.21.28.4.23 + 1.22.19.24.8.11 + 1.22.29.5.16 + 1.25.7.9.26.17.31.20.13 + 1.26 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 1.28.19.8.25.6.20.27.29.27 + 1.28.3.22 + 1.29.18.1.21.12.13.27.32.15 + 1.3.15.11.11.25.24.21.19 + 1.30.18.31.12.25.4.19.28.12.15 + 1.30.31.31.20.16.7 + 1.31.3 + 1.4.14.32.14 + 1.8 + 1.9.18.10.1.26.22.16.17 + 10.11.25.2.24.18.18.21.6.26.21 + 10.12.23.22.23.22.20.17.17.9 + 10.12.9.6.6.26.14.8.23.1.25 + 10.13.12.8.4.8.11.30 + 10.13.22.1.8.30.9.24.1.2.1 + 10.15.16.3 + 10.16.18.9.27.2.29.32.24.13 + 10.16.19.7.15 + 10.18.12.27.24.30.32.7.11.5.13 + 10.2.17.26.16.7.19.6.23.3 + 10.20 + 10.22.1 + 10.22.30.16.2.21.17.13 + 10.26.27.23.4.31.11.25.29 + 10.26.30.15.1 + 10.27.7.24.26.11.31.20.29 + 10.28.22.29.13.19.6.7.6.14 + 10.28.7.16.31 + 10.29 + 10.29.26.4.27.17.11 + 10.3 + 10.3.19 + 10.31 + 10.31.25.31.24.16.17 + 10.32.14 + 10.5.23.5.32.9.18.5.30 + 10.5.5.15.29.2 + 10.7.9 + 10.8.20.11.12.23.22 + 11.1 + 11.1.3.28.30.21.24.14 + 11.10 + 11.10.22.18 + 11.11.11.4.23.21.25 + 11.11.9.30.15.29.15.18 + 11.12.6.21 + 11.14.21.24.10.7.29.23.24.28 + 11.15.11.19.29.10 + 11.16.16.28.14 + 11.17.10 + 11.17.17.24.11.23.17.17.18.10.22 + 11.18.4.8.3.13.14.28.18.31 + 11.19.23.3.6.11 + 11.2.27.3 + 11.21.13.9.19 + 11.21.16.27.16 + 11.22.28.8.12.23.25.15.21.28 + 11.29 + 11.3.15.28.22.8.14 + 11.30 + 11.30.20.15.18.32.1.18.25.26.8 + 11.32.18.31 + 11.6.11.29.4.5.24.6.26.12 + 11.7.31.15.22 + 11.8.18 + 12.1.1 + 12.1.28.22.25 + 12.10 + 12.10.11.9.10.31.4.16.31 + 12.11.17.1.2 + 12.11.20.20.29 + 12.13.16.17.29.27.16.14.9.19.9 + 12.13.5.31 + 12.14.20.8.28.4 + 12.15.10.17.18.13 + 12.16.13 + 12.16.2.4.15 + 12.17.10.7.17.16 + 12.18 + 12.2.4.28.21.30.24 + 12.21.15.27.24.15.8.24.24.26 + 12.21.20.20 + 12.22.20.4.12 + 12.23.3.19.29.15.12.6 + 12.24.29.32.32.29.2 + 12.25.32.2.27.3.3.16 + 12.27.23.32.1.1.9.29.13 + 12.27.30.12.24.2.20 + 12.28.12.24.28.15.5.12.30.13.21 + 12.29.17.2.20.29.1.11.19.8.12 + 12.29.26.18.4.21.28.8.13.3 +(123 rows) + +SELECT * FROM ltreetest WHERE t <= '12.3' order by t asc; + t +---------------------------------- + + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 + 1.1.2 + 1.1.2.1 + 1.1.3 + 1.1.7.32.11.22 + 1.10.21 + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.10.5.22.13 + 1.11.10.19.6.1.26.17.2.22 + 1.12.25.26.22.8.15.23 + 1.13.16.27.11.16.30.2.9.18.4 + 1.14.3.7.3.17.2.29 + 1.15.17.6.28.25.24.31.27.9 + 1.16.8.18.14.16.21.25.6 + 1.18.29.30.22.14.3.20.15.21.20 + 1.19.22.11.14.7.32.23.19.14 + 1.20.18.25.3.24.25.10.9 + 1.20.22.26.2.6.11 + 1.21.28.4.23 + 1.22.19.24.8.11 + 1.22.29.5.16 + 1.25.7.9.26.17.31.20.13 + 1.26 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 1.28.19.8.25.6.20.27.29.27 + 1.28.3.22 + 1.29.18.1.21.12.13.27.32.15 + 1.3.15.11.11.25.24.21.19 + 1.30.18.31.12.25.4.19.28.12.15 + 1.30.31.31.20.16.7 + 1.31.3 + 1.4.14.32.14 + 1.8 + 1.9.18.10.1.26.22.16.17 + 10.11.25.2.24.18.18.21.6.26.21 + 10.12.23.22.23.22.20.17.17.9 + 10.12.9.6.6.26.14.8.23.1.25 + 10.13.12.8.4.8.11.30 + 10.13.22.1.8.30.9.24.1.2.1 + 10.15.16.3 + 10.16.18.9.27.2.29.32.24.13 + 10.16.19.7.15 + 10.18.12.27.24.30.32.7.11.5.13 + 10.2.17.26.16.7.19.6.23.3 + 10.20 + 10.22.1 + 10.22.30.16.2.21.17.13 + 10.26.27.23.4.31.11.25.29 + 10.26.30.15.1 + 10.27.7.24.26.11.31.20.29 + 10.28.22.29.13.19.6.7.6.14 + 10.28.7.16.31 + 10.29 + 10.29.26.4.27.17.11 + 10.3 + 10.3.19 + 10.31 + 10.31.25.31.24.16.17 + 10.32.14 + 10.5.23.5.32.9.18.5.30 + 10.5.5.15.29.2 + 10.7.9 + 10.8.20.11.12.23.22 + 11.1 + 11.1.3.28.30.21.24.14 + 11.10 + 11.10.22.18 + 11.11.11.4.23.21.25 + 11.11.9.30.15.29.15.18 + 11.12.6.21 + 11.14.21.24.10.7.29.23.24.28 + 11.15.11.19.29.10 + 11.16.16.28.14 + 11.17.10 + 11.17.17.24.11.23.17.17.18.10.22 + 11.18.4.8.3.13.14.28.18.31 + 11.19.23.3.6.11 + 11.2.27.3 + 11.21.13.9.19 + 11.21.16.27.16 + 11.22.28.8.12.23.25.15.21.28 + 11.29 + 11.3.15.28.22.8.14 + 11.30 + 11.30.20.15.18.32.1.18.25.26.8 + 11.32.18.31 + 11.6.11.29.4.5.24.6.26.12 + 11.7.31.15.22 + 11.8.18 + 12.1.1 + 12.1.28.22.25 + 12.10 + 12.10.11.9.10.31.4.16.31 + 12.11.17.1.2 + 12.11.20.20.29 + 12.13.16.17.29.27.16.14.9.19.9 + 12.13.5.31 + 12.14.20.8.28.4 + 12.15.10.17.18.13 + 12.16.13 + 12.16.2.4.15 + 12.17.10.7.17.16 + 12.18 + 12.2.4.28.21.30.24 + 12.21.15.27.24.15.8.24.24.26 + 12.21.20.20 + 12.22.20.4.12 + 12.23.3.19.29.15.12.6 + 12.24.29.32.32.29.2 + 12.25.32.2.27.3.3.16 + 12.27.23.32.1.1.9.29.13 + 12.27.30.12.24.2.20 + 12.28.12.24.28.15.5.12.30.13.21 + 12.29.17.2.20.29.1.11.19.8.12 + 12.29.26.18.4.21.28.8.13.3 + 12.3 +(124 rows) + +SELECT * FROM ltreetest WHERE t = '12.3' order by t asc; + t +------ + 12.3 +(1 row) + +SELECT * FROM ltreetest WHERE t >= '12.3' order by t asc; + t +---------------------------------- + 12.3 + 12.4.10.17.4.10.23.3 + 12.4.12.13.25.30.30.8.9.12 + 12.4.24.6.1.13.5.20 + 12.4.26.23.25.5.15.7.16 + 12.6.14.23.19.21.9.12 + 12.7.16.8.21.22.2.16.18 + 12.7.28.26.14.21.18.31.5.15.11 + 13.1.6.17.28.9.15.30.1.27.14 + 13.12 + 13.14.13.10.28.26.9.18.27.21 + 13.16.1.27.18.18.19.6.14.4 + 13.16.4.28 + 13.17.7 + 13.19.2.6.23.19.9.7.21.8.16 + 13.24 + 13.25.10.25.8.16 + 13.26.17.3.2.19 + 13.28.12.6 + 13.28.14.2.8.18 + 13.28.9.3 + 13.3.20 + 13.3.8 + 13.30.24 + 13.32.15.32.26.14.32 + 13.7 + 13.8.15.3.7.31.5.10.15.30 + 13.8.20.9.21 + 13.8.23.13.11.18.24.21.11.24.10 + 13.9.9.27.31.11.25.9.27.22.13 + 14.1.11 + 14.1.15.25.27.23.25.26.28.10 + 14.10.11.30.5.7.6.24.9.30.26 + 14.11.25 + 14.12.31 + 14.13.9.13.11.5.5.2.2.32.12 + 14.14.25 + 14.15.31.29 + 14.16.6.29.26.13.14.16.25.26.8 + 14.17.7.30.8.25.26.4 + 14.19.20.13.27.2.2 + 14.19.26.15.22.23 + 14.19.30.6.4.10.10.10.22.25.11 + 14.2.14.11.12 + 14.21.22 + 14.21.5.28.3.32.24.14.25.31 + 14.21.6.5.26.9.32.16.25 + 14.23.31.5.5.15.17.12.17.7.3 + 14.24 + 14.26.25.4.12.26.8 + 14.27.29.23.4.1.17.32.6.25.22 + 14.29 + 14.3.17.1.14.15.21.4.26 + 14.30.13.5.26.9.22.23.14.10 + 14.30.2.21.15.16.13 + 14.30.23.3 + 14.4.19.27.28.24.19 + 14.4.23.4.23.22.11.6.26.5 + 14.5.13.19.25.12.32.9.13.16.12 + 14.6.10.29.25.26.20.24.24 + 14.8.15.30.7.29.27.31.4 + 14.9.15.21.21.31.1.29 + 15.1.6.31.30.13.32.9.10 + 15.1.8 + 15.10.30.1.4.12.8.20 + 15.11.26.1.30.6.23.5 + 15.17 + 15.17.2.32.7 + 15.21.22 + 15.21.23.30.9.25 + 15.23.26.20.27.7 + 15.25.31.11.4.22.16.7.11 + 15.26.24.31.16.15.17.22.8.30.3 + 15.28.24 + 15.28.30.19.31.6.2.2.31 + 15.29.25 + 15.29.32.16.29.12.20.32.13.20 + 15.3.31.9.27.14.9.8.14.6.32 + 15.30.17.5.32.28.2.18.27 + 15.31.11.27.19.19.20.5.5 + 15.4.15 + 15.5.1.31.28.10.8 + 15.6.19.3 + 15.7.3.14.23.19.26 + 15.7.5.12.7.9.3.28.26 + 15.8.10 + 15.8.3.15.27.14.29.28.6.5.25 + 15.9.11.20.22.15.11.13 + 15.9.8.20.27 + 16.13.19.11.18.13.17.17 + 16.13.2.19.14.29.31.30.23.15.12 + 16.13.26.18.9.29.11.17.1.24.26 + 16.14.3.17.17.26.12.19.19.30 + 16.16.28.24.11 + 16.18.23.6.31 + 16.19.17.30.30.5.17.24.27 + 16.2.14.3.26.11 + 16.20.29.26 + 16.21.13.1.4 + 16.23.30.12.31.31.19.14 + 16.24.3.30.15.22.31.2 + 16.24.7.25 + 16.27.8.17.14.17.21.29.14 + 16.28 + 16.29.6.23.13.28.31.6.19.26.15 + 16.30.10.7.29.4.9.21.22.13.26 + 16.31.12.27.25.9.32.29 + 16.5 + 16.5.10.2.18.8.15.12.32.25.10 + 16.5.12.5.15.12.24.25.3 + 16.5.14.21.32.17.23.3.4.26 + 16.5.23.17 + 16.5.6.12 + 16.8.29.7.21.2.3 + 16.9.14.28.6.21.31.31.26 + 16.9.29 + 16.9.32.14.3.7.8.7.21.22 + 17.1.12.20 + 17.10.17.22.20.25.14.13 + 17.11.17.4.8.26.26.20.6 + 17.13.14.29.27.27.13.12.15 + 17.13.19.31.12.18.10.15.14 + 17.13.8 + 17.14.7.3.2.18.20.23.18.5 + 17.17.14.28.6.30 + 17.19.1.22.11.7.22.1.14.28.11 + 17.22.12.10.30.11 + 17.24.15.27.3.32.4.22.20.6.24 + 17.24.30.6.32 + 17.25.10.13.21.5.7.22.2 + 17.25.2.13.10.27.13.1 + 17.25.26.23.32 + 17.26.18 + 17.27 + 17.29.21.10.18.8.16.26.18.21.26 + 17.29.31.8.24.10.18.27.17 + 17.3 + 17.5.3.15.17.13.5 + 17.7.26.30.18.23.4 + 17.8 + 17.8.31.32 + 17.9.32.31.21.31.23.17.10.32.9 + 18.13.6.12.26.26.26.29.18.20.1 + 18.13.9.3.18.15.2 + 18.15.14 + 18.17.6.16.6.10 + 18.18.19.16.14.16.21.10.25 + 18.18.5.11.7.4.25 + 18.19.11.20.13.13.11 + 18.19.12.20.18.17.15.32.18.5 + 18.21 + 18.24.21.17.11.26.28.22.21.18.10 + 18.27.11.27.9.16.7.6.22.26.27 + 18.29.13.24.18.3.12.18.12.12 + 18.29.5.1.10.21.2 + 18.30.11.17 + 18.30.18.31 + 18.31.26.18.6.15.18.11 + 18.31.32.28.1.4.24.24.12.25 + 18.31.32.29.22.1.31.11.28 + 18.4 + 18.4.14.29.3 + 18.5.6.31.5.15.15 + 18.6.2.2.24 + 18.6.26.2.13.9.6.11.10.11.16 + 18.7.10.27.17.24 + 18.7.3.17.13.5.31.6.31.25.29 + 18.9.21.2.31.8.32 + 18.9.26.7 + 19.10.26.19.5.21.30.23 + 19.10.4.30.32.4.12 + 19.10.8.10.4.19 + 19.11.10.18.14.13.7.7 + 19.11.29.13.15.27.12.15.14.12 + 19.12.20.24.32.13.11.23.26 + 19.12.26.24.29.3 + 19.12.30.2.21 + 19.15.26.19 + 19.16.26.2 + 19.16.31.31.29.12 + 19.17.12.15 + 19.17.13.12.32.16.3 + 19.19.25.22.11.6.15.3.2.19 + 19.2.26.21.16.11.2.2 + 19.2.9.29.6 + 19.20.25.7.27.28.27.17.9.3.1 + 19.22.21.13.27.13.15 + 19.22.29.32.1.21.26.24.23.17 + 19.26.24.27.6.24.16.27.32.29 + 19.26.32.13.1.12.30.26.22.25 + 19.3.12.12 + 19.3.23.4.4.21.23 + 19.30.18.11.32.14 + 19.30.27.26.21.7.18 + 19.31.14.25.5.8.21.11.13.20 + 19.5.20.3.4.2.3 + 19.6.13.14.22.13.9.29 + 19.6.24.32.30.13.6.25.8.28 + 19.7 + 19.7.29.31.3.20.7.21.25.27.29 + 19.9.32.23.13.24.1 + 2.1.12.19.29.28.3.31.28.28.10 + 2.1.3.30.24.17.9 + 2.10.10.4.20.1.12.13 + 2.10.28.1.17.19.32.28 + 2.11.32.25.23 + 2.12.14.28.16.21 + 2.12.30.22.12 + 2.13.9.23.21.2 + 2.13.9.28 + 2.14.10.4.17.17.8.4.27.20 + 2.14.12.13 + 2.15.14.20.30.26 + 2.15.18.21.5.21.4.7.30 + 2.16.3.7.22.18.29.20 + 2.19.4.1.15.7.8.9.17.29 + 2.2.18.18.3.3.18.8.10.8 + 2.22.19 + 2.24.4.5.24.32 + 2.24.5.3.4.10.27.26.17.28.16 + 2.27.15.14 + 2.28.5.17.6.32 + 2.30.26.10.14.31.18.2 + 2.31.25 + 2.32.10.13.12 + 2.32.8.28.24.20.9.24.25.8.9 + 2.4.25.32.16.22.26.13.17.18 + 2.6.15.26.23.26.24 + 2.8.13.12.17.23.16.7.11.23 + 2.9 + 20.1.24.3.30.31 + 20.13 + 20.14.11.2.10.14 + 20.15 + 20.17.14.7 + 20.17.18.21.1 + 20.18.24.14.12.13.9 + 20.20.32.29.24.5.5.26.22.32 + 20.20.7 + 20.22.10 + 20.23.29.5.7.30.13.14.22 + 20.23.7.11.11.31.18.16.3 + 20.24.14.15.4.21.12.27.4.12 + 20.25.22.19.22 + 20.28.22.7.10.28.27.22.14.16 + 20.29.18.16.2.21.23.11 + 20.3.1.8.8.30.20 + 20.30.17 + 20.30.28.15.17 + 20.30.9.9.14.12.29 + 20.31.13.12.19.2.26.16.16.22.28 + 20.32.5.1.3.20.3.30.27 + 20.32.9 + 20.4.1.16.31.3 + 20.4.27.31.1 + 20.5.4.9.31.14.26.6 + 20.6.26.3.30 + 20.6.3.26.7.29.28.4 + 20.8.19.14.16.7 + 20.9.29.32.13.7.23 + 21.1.4.9.9.31.24.21.3.29 + 21.10.20.9.3.16.9.10.20 + 21.14 + 21.14.13 + 21.14.22.29 + 21.14.25.20.13.31.14.20 + 21.15.18.18.30.3.20 + 21.15.31.24.29.24.26.12.20 + 21.17.18.32.7.8 + 21.17.27.23.15 + 21.17.31.10.31.13.9.26.6.14 + 21.18 + 21.18.2.1 + 21.18.30.19.24.24 + 21.20.24.25.6.26.23 + 21.20.28.19.27.9 + 21.21.10.27 + 21.22.31.24.27 + 21.23.13 + 21.23.17.8.23.11.8.1 + 21.28.17.22.10.27.4.20.2.32 + 21.28.24.23.3.11.7.12.22.32 + 21.30.19.6.28.1.32.2.14.14 + 21.31.31.25.5.30.26 + 21.32.13.21 + 21.32.13.22.3.13.31.23.14.12.9 + 21.4.11.18 + 21.4.22.20.24.28.6 + 21.5.11.18 + 21.5.17.19.15.25.18.21.24.9 + 21.6.22.28.12.23.11.22 + 21.7.23.9.16.5.18.14 + 21.7.7.11 + 21.8.9 + 21.9.27.22.32 + 21.9.32.1.27 + 22.10.12.23.9 + 22.10.16.8 + 22.10.18 + 22.10.27.19.29.20.29.3.12.14.25 + 22.11 + 22.12.22.28 + 22.13.22.21.25.17.8 + 22.13.22.8.30.32.10.24 + 22.15 + 22.16 + 22.16.25.18.25.7.24.29.14.8 + 22.17.24.14.21.15.12.18.17.25.11 + 22.17.30 + 22.17.4.2.22.17 + 22.17.7.30.13.24 + 22.17.9.11.25.15.3.9 + 22.18.20.23.15.9.12 + 22.19.20.5.2.20 + 22.19.21.11.6.8.29.24 + 22.19.5.22.20.31.23.24.14.24.4 + 22.20.30 + 22.21.32.15.8.29.5.12.10.29 + 22.22.10.30.5.15.25.21.19.11 + 22.22.27.6.27.15.5.18.21.28.9 + 22.23.18.18.9.8.23.7.23.23.16 + 22.23.22.30 + 22.23.25.28.5.27.9.9.24.31.10 + 22.24.22.25.15.23.13 + 22.25.4.28.9.20.12.13 + 22.26.1.28.9.9.31 + 22.26.32 + 22.28.20.6.32.32 + 22.29.18.32.13.12.22.31.17.22 + 22.29.29.11 + 22.3.6 + 22.30 + 22.30.31.24.23.22.5.20.28.1 + 22.31.2.32.32.11.26.23.19 + 22.31.21.13.13.26.11.5.19 + 22.32.6.6.3.8.24.6.25.29 + 22.8.20.1.10.28.6.27 + 22.9.15.19.12 + 23.1.23.18.12.29 + 23.10.13.32.14.20.16.11.14 + 23.10.5.26.12.4.20.4 + 23.12.1.5.32.25.8.24.1.25 + 23.12.11.11.15.16.22.31.32.5.8 + 23.12.19.25.16.23.22.6.29.4 + 23.12.32.22.19.1.22.4 + 23.14.12.30.18.4.16.18.7.7 + 23.14.30.27.28.26.26.23.8.32 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.17.28.31.28 + 23.17.32.15.23.16.25 + 23.19.17.31.29.13.1.12.5.25 + 23.2.22.7.32.3.27.6 + 23.20.12.16.15.2 + 23.20.24 + 23.20.8 + 23.22.10.1.14.24 + 23.22.23.14.31.32 + 23.23 + 23.24.11.31.10.31.18.28.13.18.6 + 23.24.16.32.13.29 + 23.25.23.11.7.23 + 23.27.27.16 + 23.27.6.26.22 + 23.28.1 + 23.28.20.25.30.24.15 + 23.28.3.30.15.31.32.3.21.9.19 + 23.3.20.24 + 23.3.32.21.5.14.10.17.1 + 23.31.27.16.8.30.20.27 + 23.32.5.25.19.9.15.17.15.11 + 23.5.5.17 + 23.5.7.12.11.23.10 + 23.6.27 + 23.8.13.22.21 + 24.1.10.20.28.18.6.27.20.30.26 + 24.1.29.32.14.15.32.6.15.22 + 24.10.10.31.4.29.9 + 24.10.8.25.16 + 24.11.5 + 24.12 + 24.13.1.8 + 24.15.15.17.22 + 24.16.27.10.9 + 24.17.24 + 24.17.31.20.12.9.19.29.18 + 24.18.16 + 24.2.26.24.14.15.31.23.17.26 + 24.2.6.7.16.7.28 + 24.20.23 + 24.21.14.25.11.3.20.6.6.16 + 24.23.24.4.15.25.17 + 24.23.29.8.24.11.21.10.28.14.27 + 24.24 + 24.25.7.27.30.8.26.17 + 24.27.14 + 24.27.18.32.14.9.11.28.9 + 24.28.13.26.8.8.31 + 24.28.32.21 + 24.3.23.25 + 24.31 + 24.31.2.13.5.23.18.16 + 24.31.8 + 24.32.17.23.24.19.23.9.20.18 + 24.32.27 + 24.9 + 24.9.15.1.14.29.6.4 + 24.9.27.16.20.21 + 24.9.8.12.29 + 25.10 + 25.10.29.3.6.21.3.31.13 + 25.10.4.28.3.31.19 + 25.11.24 + 25.14.5.32.25 + 25.15.11 + 25.16.9.6 + 25.17.18.17.27 + 25.17.18.30 + 25.17.2.20.20.3.29.21.3.12 + 25.17.9.16.17.31.23.29.24 + 25.18.8.3.23.23.5.9.6 + 25.19.27.2.9.20 + 25.2.11.20.8.6.22 + 25.2.3.15.11.19.5.28.25.14 + 25.21.8.17 + 25.22.2.25.6 + 25.24.2.32.14.18.16 + 25.24.29 + 25.28.3 + 25.28.30.24 + 25.29 + 25.3 + 25.30.1.4.24.11 + 25.31 + 25.32.24.24.28.15.16.10 + 25.4.32 + 25.4.4.1.13.32.26.20.20.3 + 25.5.30.7.16.12.21.12.11.16 + 25.6 + 25.6.12.16.1 + 25.7.3.21.31.12.28 + 25.9 + 25.9.1.5.9.11.25.4.11.27.32 + 25.9.10 + 26.11 + 26.12.27.2 + 26.13.4.7.13.11.3 + 26.14 + 26.14.5.32.10 + 26.16.12 + 26.16.12.3.27.9.28 + 26.17.9.13.4.25.32.2.24.9 + 26.18 + 26.18.32.20 + 26.19.3.14.8.28.31.10 + 26.24 + 26.24.9.12.11.15.31.2 + 26.25.10.10.13 + 26.25.24 + 26.26.22.21.14.11.29.19.14.24 + 26.28.14 + 26.31.11.23.3 + 26.31.16.18.22.13.32.23.9.20 + 26.31.6.8.29.8.24 + 26.31.7 + 26.32.21.31.27.12 + 26.32.8.12.30.19.24.8.6.1.10 + 26.5.29.7.28 + 26.7.22.3.18.21.11 + 26.7.5.8.11.9.22.1.6 + 26.8.28 + 26.9.17.1.18.19.1.11.18.29.3 + 26.9.20.12.22.22.32 + 27.1.11.3.25.9.6.6 + 27.11.14.17.24 + 27.11.15.9.24.31.18.4.1.30.20 + 27.12.4.2.29.22.15 + 27.15.15.15 + 27.16 + 27.17.15.7.28.20 + 27.17.17.19.24.9.14.20 + 27.17.3.18.2.13.18 + 27.18 + 27.18.10.4.22 + 27.19.20.1.31.29.5.22.26.3 + 27.2.10.4.25.14.2.15.4 + 27.21.27.5.13.30.17 + 27.21.28.24.7.2.24.23.8 + 27.22.11.13.21.25.5.1.27.21.27 + 27.23.2.32.11.21 + 27.23.20.30.7 + 27.24.11.31.21.6.29.17.24.18 + 27.25 + 27.26.29 + 27.27 + 27.27.25.10.31.10.21.22.21.16.12 + 27.27.30.11.15.24.9.7.4.30 + 27.29.1.5.30.6.22.16.23.2.28 + 27.3 + 27.3.3.11.21.4.25 + 27.30.12.11.20.15.11.13 + 27.31.2.16.29.6 + 27.32.26.21.31.17.32.32 + 27.4 + 27.4.15.14.19.6.12 + 27.4.17.17.32.8.16.15.17.13 + 27.5.15.1.15.16.21 + 27.5.22 + 27.6.13.24.21.27.28.22.3.7.4 + 28.1.3 + 28.11.11.30.20.11.32 + 28.11.27.21.14.16 + 28.14.24.26.6.15.16.32.25.13.8 + 28.14.32.29.2.3.4 + 28.15.18.27 + 28.15.25.7.13.6.19.2 + 28.17.26.9 + 28.18.6.22.13.8.25 + 28.2.27.1.20 + 28.20.8.9.9.28.30.29 + 28.23.2.30.3.8.1.15.15.14.13 + 28.25.10.25.19.15 + 28.25.11.22 + 28.25.29.4.13.5.6 + 28.26.25.7 + 28.26.26.6.31 + 28.26.4.22.13.20.32.27.15 + 28.27.24.14 + 28.28 + 28.30.24.16.17.28.2.13.10 + 28.31.10.28.22.26.16.15 + 28.4 + 28.5.12.9.2.27.11.11.2 + 28.5.13 + 28.6 + 28.6.11.6.15.22.12.6 + 28.6.8.22.25 + 28.8.21.15.16.28.4.16.26.8 + 28.9.3.16.17.21.23.30 + 29.1 + 29.1.2.14.14 + 29.1.7.26.25.11.22 + 29.10.12.17.12.16 + 29.10.17.11.28.12.18.5.19.15.21 + 29.11.20.22.27 + 29.14.12.9.17.5.32 + 29.14.31.25.7.32.23 + 29.15.29.8.31.26.1 + 29.20.1.11.21.16.1.2.14.28 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 29.25.29.16.32.11.15.25.5.22.3 + 29.25.30.15.21.3.25.26.26 + 29.26.25.14.24.18.2.13.23.29 + 29.27 + 29.27.13.29.10.2 + 29.27.13.9.28.29.19.13.29.31.27 + 29.27.5.22.26 + 29.27.7.7.3.11.14.26.21.11 + 29.28.9.15.8.27.31 + 29.29.17.31 + 29.29.18 + 29.3.15.17.12.29 + 29.3.17.17.18.32 + 29.30.21.8.16.23.32 + 29.30.7.31.22 + 29.32.13.4.1.16.20 + 29.5.18.27.3.21.18.6.14 + 29.5.32.20.11.7.13.24.17 + 29.6.12.31.20.23.32.20 + 29.9.25.27.15.16.32.26.6.32 + 3.1.13.22.24.14.12.31.3.4 + 3.1.14.8.9.16.30.22.20 + 3.10 + 3.10.27.4.5.6.19.12.28.12 + 3.10.4.5.28.11 + 3.11.18.21.5.20.30 + 3.11.32.11.22.3.7.17.8.13.23 + 3.13 + 3.14.1.14.17.28.29.16 + 3.14.11.15.21.32.2.15.13 + 3.14.30.5.32.22.29 + 3.15.2.23.22.2.16.14 + 3.18 + 3.18.18 + 3.18.8.22.7.28.32.31.3 + 3.19.11.6.5 + 3.20.16.13.29.20 + 3.20.19.10.17.27.3.6.22.23 + 3.21.16.24.23.12.16.32.3 + 3.21.6.13.12.18.25 + 3.22.18.1.5.14.9.6.14 + 3.25 + 3.26 + 3.26.32 + 3.27.18.8.4.21.6.32.30.7.5 + 3.29.19.2.24 + 3.29.32.26.8.10.25 + 3.3 + 3.32.2.29.3.32.28.11.29.30 + 3.4.22.19 + 3.5 + 3.6.24.21.20.32.3.4.26.5 + 3.9.11.23.32.26.24.28 + 3.9.25.26.7 + 30.12.28.2 + 30.12.6.30 + 30.12.9.25.24.6.7.24.29 + 30.15 + 30.16.14.9.5.4.10.7.31 + 30.16.3.21.10 + 30.17.2.25 + 30.17.25.3.31.11.3.4.1.10 + 30.17.4.5.13.6 + 30.18.30.16.29 + 30.2.17.8.14 + 30.20.3.2.5.15.8.7.17 + 30.22.29.21.19.14.3.2.6 + 30.23.10.1.10.7.22.28.18.11.17 + 30.23.2.13.14.15.29.19.4.12.24 + 30.24 + 30.24.23.25.32.18.22.12.29.9.22 + 30.24.32.15.14.10.11 + 30.25 + 30.25.17.17.10.29 + 30.25.24.22 + 30.25.8.24.6.29.31 + 30.27.8.6.11.19 + 30.3.16.26.7.27.26.9.27.21.18 + 30.30.17.5.30.21.19.5.22.22.14 + 30.31.13.9 + 30.32 + 30.4.30.11.13.23.14.24.11 + 30.5 + 30.6.4 + 30.8.18.5.20.6.15 + 30.8.9.14.25.30 + 30.9.24 + 31.13 + 31.13.9.1.5.12 + 31.17 + 31.17.2.30.11 + 31.18 + 31.18.25.1.14.29.25.5.22.30 + 31.18.27.15.20.29.29 + 31.18.32.11.7.25.20.5 + 31.21.14.20.1.22.2.5.3.27.12 + 31.21.22.14.8.21 + 31.24.26.18 + 31.28.32.4.31.4.7 + 31.29.18.26.1.26.17 + 31.29.4.29.24.30.30.32.10.23 + 31.30.12.20 + 31.30.23.7.7.24.32.10.11.1.31 + 31.32.12.26.31.32.14.23.28 + 31.4.7 + 31.5.6.4.8.29.3 + 31.7.14.2 + 31.9.3.5 + 32.1.21.1.16.29.21 + 32.1.23.20.14.12.23.5.32.15 + 32.1.24.29.22.5.9.24.18.3.13 + 32.1.31 + 32.15.20.28.5.1.23.4 + 32.16 + 32.17.8.24.2.14.5.4.22 + 32.19.20.24.23.31.8.32.16.29 + 32.2.11 + 32.24.11.8.12.23.22.19.11.17.18 + 32.24.29.6 + 32.25.16 + 32.25.3.6 + 32.27.13.6.7 + 32.27.18.7.3.4.2 + 32.28.1.32.28.10 + 32.29.24.31.25.6.9 + 32.3.12.2 + 32.3.23.7.2 + 32.3.5.9.17.15 + 32.30.18.17.1.14.12.18 + 32.31.11.22.1 + 32.31.26.19.13.29.4.25 + 32.4.19 + 32.6.13.8.32 + 32.6.15.26.14.15.3.19 + 32.6.3.2.12.5.28.1.25 + 32.6.31.31 + 32.6.8 + 32.6.9.26.16.4.4.29.7.11 + 32.8.29.18.31 + 32.8.5 + 4.1.24.24.28.24.18 + 4.10.28 + 4.11.19.17.2.22.20.18.13.32.15 + 4.11.22.4.19.24.4.28.6.8.22 + 4.13 + 4.13.22.11.9.13.27.15.7 + 4.14 + 4.14.10.19.16 + 4.14.16.14.1.8.1.22.17.10 + 4.14.17.12.20.17.1.22.3 + 4.14.32 + 4.15.20.23.12.16.2.16.17 + 4.16.22.19.24.21 + 4.16.7.25.21.7 + 4.18.29.9.16.10 + 4.19.16.15.5.2.25.8.28.14.2 + 4.2.16.13.16.11.19.10.10.25 + 4.2.2.32.24.25.31.3 + 4.2.6.20.7.8 + 4.21.28.5.16.29.5.21 + 4.21.9.1.2.14.8.17.13.26 + 4.22 + 4.22.17.10.19.9.8.19.28.3.9 + 4.22.7.19.25 + 4.25.12.10.15.9.18.9 + 4.26.2.2 + 4.26.23.6.19.31.10.4.22 + 4.26.5.26.21.28.17.24.25.23 + 4.27.32.18 + 4.3.20.27.9.1.18.30.12.5.19 + 4.3.6.27.22.23.10 + 4.30.8.20.19.9.30.24.11 + 4.31 + 4.5.9.4.15.19.8.26.17.26.3 + 4.7.1 + 4.9 + 5.1.5.31 + 5.10 + 5.10.2.11.21.9.19 + 5.10.3.9.23.30.23 + 5.12.2.20.1.24.25 + 5.13.23.19.28.26.27.6.1.22 + 5.13.23.4.9 + 5.14.27.15.11.17.3.10.27.25 + 5.14.29.2.23.16.20.22 + 5.15.10.3.23.13.32.23 + 5.15.16 + 5.18.9.25.31.21.22 + 5.19.1.26.20.6.20 + 5.2.32.19.13.29.12.13.31.29 + 5.20 + 5.21.27.13.14.11.2.16.20 + 5.23.31.18.24.32 + 5.24.24.9.32.26.31 + 5.24.25.15.27.30.20 + 5.24.4.31.3.16.25.17.13.26.11 + 5.27.16.3.30 + 5.27.21.1.29.29.28 + 5.27.28.26.14.15.6.20.1.31.13 + 5.27.32.21.5.1.11.14 + 5.3.17.29 + 5.3.29.9.22 + 5.31.8.1.5.13.21.28.29.19.2 + 5.4.8.25.12.27.2.29.28.3 + 5.5.12.31.23.13.17.22.20 + 5.8 + 5.8.17.30.15.8.19.29.30.11.6 + 5.9.19.6 + 6.1.8.6.30.29.30 + 6.10.25.12 + 6.11.11.5.16.8.14.12.9 + 6.11.31.23.12.8.30.14.27 + 6.13.31.5.7.26 + 6.14 + 6.17.10.10.7.9.27.8.29 + 6.17.26.25.27.11.10.9 + 6.18.1.4.18.23 + 6.19.29.11.2.32.21.15.32.9 + 6.19.3 + 6.19.6.4.9.11.32.17.17.3.15 + 6.2.32 + 6.20 + 6.20.14 + 6.21.30.7 + 6.22.12 + 6.25.17.32 + 6.26 + 6.26.29.10.21.28.20.19 + 6.27.26.1.20.24.6 + 6.27.29.14.8.12.26.3.21.4.1 + 6.29.32.13.30.3.16 + 6.29.6.13.14.24.10.4.14.28 + 6.5.27.19.13.26.1.18.9 + 6.6.22.8 + 6.7.25.16.13.21.7.20.25.12.4 + 6.7.7 + 6.8.7.20.2 + 6.9.1.10.10.22.6 + 6.9.29.17.4.32 + 7.10.17.21.11.29.17.25.19.4.29 + 7.11 + 7.12 + 7.12.1.10.6.17.29.24.24.4 + 7.12.23 + 7.13 + 7.13.15 + 7.14.22.29.30.14.25.1.9.26.25 + 7.16.20.17 + 7.19.10.12.31.1.27.13.19 + 7.19.12.3.21.19.18.5.2.14.10 + 7.19.6.17.15.26.21.9 + 7.21.8 + 7.23.1.24.29.13.31.19.23.17.7 + 7.23.15.32.28.27.2.2.26 + 7.26.18 + 7.27.20 + 7.30.19.25.23.15.14.29 + 7.30.5.10.10.5.30.14.9.18 + 7.31 + 7.31.2.28.15.11.17.18.19.23.6 + 7.31.4.20.17 + 7.32.10.3.30.12.14 + 7.5.28.8.17.26.31.10.15 + 7.7 + 7.7.22.24.17.32.17.25.28 + 7.7.25.22.22.26 + 8.1.29.18.22 + 8.10 + 8.11.20 + 8.12.4 + 8.13.1 + 8.13.14.11.11.29.22.4.4.10 + 8.13.6.12.18.7 + 8.13.9.31.20.20.24.7.23.31.28 + 8.14.19.18 + 8.16 + 8.16.1.16.28.6.3.22.6.23 + 8.16.20.24.20.6.10.21 + 8.16.30.29.19.22.28.24.2 + 8.16.6 + 8.17.25.26.15.25 + 8.17.9.15.21.28.1.7.1.3.6 + 8.2 + 8.2.18.23.5.16.17.1 + 8.21.17.3.6.3.18 + 8.21.8.23.4.18 + 8.22.32.17.16.28.31.23.22.9 + 8.24.11.13.25.19 + 8.25.20.3.15.24.7.4.24.5.30 + 8.26.29.13.7.25.31.28.3.32 + 8.27.3.4.12.26.16 + 8.29.6.3 + 8.3.18.13.30.20.27.26.17.28 + 8.3.3.25.25.15.7.13.21.18 + 8.31.22.27 + 8.32.30.1 + 8.5.24.9.29.32.31.30.13.9.7 + 8.5.30.29.9.31 + 8.6.6.5.8.8.12 + 8.9.21.16.29 + 8.9.22 + 8.9.25.25.26.30.31.31.2.32.7 + 9.10.19.18.15.11.22.32.32.14.9 + 9.10.32 + 9.14.27.31.26.21.25.3.20 + 9.16.2.16.22.24.17.31.14.21.17 + 9.17.13.31.7 + 9.18.23 + 9.18.30.11.29.32.7.19.2 + 9.19.7.13.13.25 + 9.2.10.4 + 9.2.4.27.26 + 9.21.14.19 + 9.21.20.29.1 + 9.21.28.8.12.15.3.13.10.11 + 9.22.10.15.5.15 + 9.23.21.22.5.29.15.21 + 9.26.1.16 + 9.28.10.26.14.26.15.14 + 9.28.24 + 9.28.30.1.6.25.17.9 + 9.3.3 + 9.3.31.18.12.3.9.29.10 + 9.30 + 9.31.23.19.5.10.16.4.30.24.5 + 9.31.4.14.31.10.17.5.2 + 9.5 + 9.5.9.3.23.9.25.14.1.29.28 + 9.6.9.21.6.11.29.13.29.20.32 + 9.7.31.11.8.23 + 9.8.23.2.20.16 + 9.9.13.9.14.27 +(883 rows) + +SELECT * FROM ltreetest WHERE t > '12.3' order by t asc; + t +---------------------------------- + 12.4.10.17.4.10.23.3 + 12.4.12.13.25.30.30.8.9.12 + 12.4.24.6.1.13.5.20 + 12.4.26.23.25.5.15.7.16 + 12.6.14.23.19.21.9.12 + 12.7.16.8.21.22.2.16.18 + 12.7.28.26.14.21.18.31.5.15.11 + 13.1.6.17.28.9.15.30.1.27.14 + 13.12 + 13.14.13.10.28.26.9.18.27.21 + 13.16.1.27.18.18.19.6.14.4 + 13.16.4.28 + 13.17.7 + 13.19.2.6.23.19.9.7.21.8.16 + 13.24 + 13.25.10.25.8.16 + 13.26.17.3.2.19 + 13.28.12.6 + 13.28.14.2.8.18 + 13.28.9.3 + 13.3.20 + 13.3.8 + 13.30.24 + 13.32.15.32.26.14.32 + 13.7 + 13.8.15.3.7.31.5.10.15.30 + 13.8.20.9.21 + 13.8.23.13.11.18.24.21.11.24.10 + 13.9.9.27.31.11.25.9.27.22.13 + 14.1.11 + 14.1.15.25.27.23.25.26.28.10 + 14.10.11.30.5.7.6.24.9.30.26 + 14.11.25 + 14.12.31 + 14.13.9.13.11.5.5.2.2.32.12 + 14.14.25 + 14.15.31.29 + 14.16.6.29.26.13.14.16.25.26.8 + 14.17.7.30.8.25.26.4 + 14.19.20.13.27.2.2 + 14.19.26.15.22.23 + 14.19.30.6.4.10.10.10.22.25.11 + 14.2.14.11.12 + 14.21.22 + 14.21.5.28.3.32.24.14.25.31 + 14.21.6.5.26.9.32.16.25 + 14.23.31.5.5.15.17.12.17.7.3 + 14.24 + 14.26.25.4.12.26.8 + 14.27.29.23.4.1.17.32.6.25.22 + 14.29 + 14.3.17.1.14.15.21.4.26 + 14.30.13.5.26.9.22.23.14.10 + 14.30.2.21.15.16.13 + 14.30.23.3 + 14.4.19.27.28.24.19 + 14.4.23.4.23.22.11.6.26.5 + 14.5.13.19.25.12.32.9.13.16.12 + 14.6.10.29.25.26.20.24.24 + 14.8.15.30.7.29.27.31.4 + 14.9.15.21.21.31.1.29 + 15.1.6.31.30.13.32.9.10 + 15.1.8 + 15.10.30.1.4.12.8.20 + 15.11.26.1.30.6.23.5 + 15.17 + 15.17.2.32.7 + 15.21.22 + 15.21.23.30.9.25 + 15.23.26.20.27.7 + 15.25.31.11.4.22.16.7.11 + 15.26.24.31.16.15.17.22.8.30.3 + 15.28.24 + 15.28.30.19.31.6.2.2.31 + 15.29.25 + 15.29.32.16.29.12.20.32.13.20 + 15.3.31.9.27.14.9.8.14.6.32 + 15.30.17.5.32.28.2.18.27 + 15.31.11.27.19.19.20.5.5 + 15.4.15 + 15.5.1.31.28.10.8 + 15.6.19.3 + 15.7.3.14.23.19.26 + 15.7.5.12.7.9.3.28.26 + 15.8.10 + 15.8.3.15.27.14.29.28.6.5.25 + 15.9.11.20.22.15.11.13 + 15.9.8.20.27 + 16.13.19.11.18.13.17.17 + 16.13.2.19.14.29.31.30.23.15.12 + 16.13.26.18.9.29.11.17.1.24.26 + 16.14.3.17.17.26.12.19.19.30 + 16.16.28.24.11 + 16.18.23.6.31 + 16.19.17.30.30.5.17.24.27 + 16.2.14.3.26.11 + 16.20.29.26 + 16.21.13.1.4 + 16.23.30.12.31.31.19.14 + 16.24.3.30.15.22.31.2 + 16.24.7.25 + 16.27.8.17.14.17.21.29.14 + 16.28 + 16.29.6.23.13.28.31.6.19.26.15 + 16.30.10.7.29.4.9.21.22.13.26 + 16.31.12.27.25.9.32.29 + 16.5 + 16.5.10.2.18.8.15.12.32.25.10 + 16.5.12.5.15.12.24.25.3 + 16.5.14.21.32.17.23.3.4.26 + 16.5.23.17 + 16.5.6.12 + 16.8.29.7.21.2.3 + 16.9.14.28.6.21.31.31.26 + 16.9.29 + 16.9.32.14.3.7.8.7.21.22 + 17.1.12.20 + 17.10.17.22.20.25.14.13 + 17.11.17.4.8.26.26.20.6 + 17.13.14.29.27.27.13.12.15 + 17.13.19.31.12.18.10.15.14 + 17.13.8 + 17.14.7.3.2.18.20.23.18.5 + 17.17.14.28.6.30 + 17.19.1.22.11.7.22.1.14.28.11 + 17.22.12.10.30.11 + 17.24.15.27.3.32.4.22.20.6.24 + 17.24.30.6.32 + 17.25.10.13.21.5.7.22.2 + 17.25.2.13.10.27.13.1 + 17.25.26.23.32 + 17.26.18 + 17.27 + 17.29.21.10.18.8.16.26.18.21.26 + 17.29.31.8.24.10.18.27.17 + 17.3 + 17.5.3.15.17.13.5 + 17.7.26.30.18.23.4 + 17.8 + 17.8.31.32 + 17.9.32.31.21.31.23.17.10.32.9 + 18.13.6.12.26.26.26.29.18.20.1 + 18.13.9.3.18.15.2 + 18.15.14 + 18.17.6.16.6.10 + 18.18.19.16.14.16.21.10.25 + 18.18.5.11.7.4.25 + 18.19.11.20.13.13.11 + 18.19.12.20.18.17.15.32.18.5 + 18.21 + 18.24.21.17.11.26.28.22.21.18.10 + 18.27.11.27.9.16.7.6.22.26.27 + 18.29.13.24.18.3.12.18.12.12 + 18.29.5.1.10.21.2 + 18.30.11.17 + 18.30.18.31 + 18.31.26.18.6.15.18.11 + 18.31.32.28.1.4.24.24.12.25 + 18.31.32.29.22.1.31.11.28 + 18.4 + 18.4.14.29.3 + 18.5.6.31.5.15.15 + 18.6.2.2.24 + 18.6.26.2.13.9.6.11.10.11.16 + 18.7.10.27.17.24 + 18.7.3.17.13.5.31.6.31.25.29 + 18.9.21.2.31.8.32 + 18.9.26.7 + 19.10.26.19.5.21.30.23 + 19.10.4.30.32.4.12 + 19.10.8.10.4.19 + 19.11.10.18.14.13.7.7 + 19.11.29.13.15.27.12.15.14.12 + 19.12.20.24.32.13.11.23.26 + 19.12.26.24.29.3 + 19.12.30.2.21 + 19.15.26.19 + 19.16.26.2 + 19.16.31.31.29.12 + 19.17.12.15 + 19.17.13.12.32.16.3 + 19.19.25.22.11.6.15.3.2.19 + 19.2.26.21.16.11.2.2 + 19.2.9.29.6 + 19.20.25.7.27.28.27.17.9.3.1 + 19.22.21.13.27.13.15 + 19.22.29.32.1.21.26.24.23.17 + 19.26.24.27.6.24.16.27.32.29 + 19.26.32.13.1.12.30.26.22.25 + 19.3.12.12 + 19.3.23.4.4.21.23 + 19.30.18.11.32.14 + 19.30.27.26.21.7.18 + 19.31.14.25.5.8.21.11.13.20 + 19.5.20.3.4.2.3 + 19.6.13.14.22.13.9.29 + 19.6.24.32.30.13.6.25.8.28 + 19.7 + 19.7.29.31.3.20.7.21.25.27.29 + 19.9.32.23.13.24.1 + 2.1.12.19.29.28.3.31.28.28.10 + 2.1.3.30.24.17.9 + 2.10.10.4.20.1.12.13 + 2.10.28.1.17.19.32.28 + 2.11.32.25.23 + 2.12.14.28.16.21 + 2.12.30.22.12 + 2.13.9.23.21.2 + 2.13.9.28 + 2.14.10.4.17.17.8.4.27.20 + 2.14.12.13 + 2.15.14.20.30.26 + 2.15.18.21.5.21.4.7.30 + 2.16.3.7.22.18.29.20 + 2.19.4.1.15.7.8.9.17.29 + 2.2.18.18.3.3.18.8.10.8 + 2.22.19 + 2.24.4.5.24.32 + 2.24.5.3.4.10.27.26.17.28.16 + 2.27.15.14 + 2.28.5.17.6.32 + 2.30.26.10.14.31.18.2 + 2.31.25 + 2.32.10.13.12 + 2.32.8.28.24.20.9.24.25.8.9 + 2.4.25.32.16.22.26.13.17.18 + 2.6.15.26.23.26.24 + 2.8.13.12.17.23.16.7.11.23 + 2.9 + 20.1.24.3.30.31 + 20.13 + 20.14.11.2.10.14 + 20.15 + 20.17.14.7 + 20.17.18.21.1 + 20.18.24.14.12.13.9 + 20.20.32.29.24.5.5.26.22.32 + 20.20.7 + 20.22.10 + 20.23.29.5.7.30.13.14.22 + 20.23.7.11.11.31.18.16.3 + 20.24.14.15.4.21.12.27.4.12 + 20.25.22.19.22 + 20.28.22.7.10.28.27.22.14.16 + 20.29.18.16.2.21.23.11 + 20.3.1.8.8.30.20 + 20.30.17 + 20.30.28.15.17 + 20.30.9.9.14.12.29 + 20.31.13.12.19.2.26.16.16.22.28 + 20.32.5.1.3.20.3.30.27 + 20.32.9 + 20.4.1.16.31.3 + 20.4.27.31.1 + 20.5.4.9.31.14.26.6 + 20.6.26.3.30 + 20.6.3.26.7.29.28.4 + 20.8.19.14.16.7 + 20.9.29.32.13.7.23 + 21.1.4.9.9.31.24.21.3.29 + 21.10.20.9.3.16.9.10.20 + 21.14 + 21.14.13 + 21.14.22.29 + 21.14.25.20.13.31.14.20 + 21.15.18.18.30.3.20 + 21.15.31.24.29.24.26.12.20 + 21.17.18.32.7.8 + 21.17.27.23.15 + 21.17.31.10.31.13.9.26.6.14 + 21.18 + 21.18.2.1 + 21.18.30.19.24.24 + 21.20.24.25.6.26.23 + 21.20.28.19.27.9 + 21.21.10.27 + 21.22.31.24.27 + 21.23.13 + 21.23.17.8.23.11.8.1 + 21.28.17.22.10.27.4.20.2.32 + 21.28.24.23.3.11.7.12.22.32 + 21.30.19.6.28.1.32.2.14.14 + 21.31.31.25.5.30.26 + 21.32.13.21 + 21.32.13.22.3.13.31.23.14.12.9 + 21.4.11.18 + 21.4.22.20.24.28.6 + 21.5.11.18 + 21.5.17.19.15.25.18.21.24.9 + 21.6.22.28.12.23.11.22 + 21.7.23.9.16.5.18.14 + 21.7.7.11 + 21.8.9 + 21.9.27.22.32 + 21.9.32.1.27 + 22.10.12.23.9 + 22.10.16.8 + 22.10.18 + 22.10.27.19.29.20.29.3.12.14.25 + 22.11 + 22.12.22.28 + 22.13.22.21.25.17.8 + 22.13.22.8.30.32.10.24 + 22.15 + 22.16 + 22.16.25.18.25.7.24.29.14.8 + 22.17.24.14.21.15.12.18.17.25.11 + 22.17.30 + 22.17.4.2.22.17 + 22.17.7.30.13.24 + 22.17.9.11.25.15.3.9 + 22.18.20.23.15.9.12 + 22.19.20.5.2.20 + 22.19.21.11.6.8.29.24 + 22.19.5.22.20.31.23.24.14.24.4 + 22.20.30 + 22.21.32.15.8.29.5.12.10.29 + 22.22.10.30.5.15.25.21.19.11 + 22.22.27.6.27.15.5.18.21.28.9 + 22.23.18.18.9.8.23.7.23.23.16 + 22.23.22.30 + 22.23.25.28.5.27.9.9.24.31.10 + 22.24.22.25.15.23.13 + 22.25.4.28.9.20.12.13 + 22.26.1.28.9.9.31 + 22.26.32 + 22.28.20.6.32.32 + 22.29.18.32.13.12.22.31.17.22 + 22.29.29.11 + 22.3.6 + 22.30 + 22.30.31.24.23.22.5.20.28.1 + 22.31.2.32.32.11.26.23.19 + 22.31.21.13.13.26.11.5.19 + 22.32.6.6.3.8.24.6.25.29 + 22.8.20.1.10.28.6.27 + 22.9.15.19.12 + 23.1.23.18.12.29 + 23.10.13.32.14.20.16.11.14 + 23.10.5.26.12.4.20.4 + 23.12.1.5.32.25.8.24.1.25 + 23.12.11.11.15.16.22.31.32.5.8 + 23.12.19.25.16.23.22.6.29.4 + 23.12.32.22.19.1.22.4 + 23.14.12.30.18.4.16.18.7.7 + 23.14.30.27.28.26.26.23.8.32 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.17.28.31.28 + 23.17.32.15.23.16.25 + 23.19.17.31.29.13.1.12.5.25 + 23.2.22.7.32.3.27.6 + 23.20.12.16.15.2 + 23.20.24 + 23.20.8 + 23.22.10.1.14.24 + 23.22.23.14.31.32 + 23.23 + 23.24.11.31.10.31.18.28.13.18.6 + 23.24.16.32.13.29 + 23.25.23.11.7.23 + 23.27.27.16 + 23.27.6.26.22 + 23.28.1 + 23.28.20.25.30.24.15 + 23.28.3.30.15.31.32.3.21.9.19 + 23.3.20.24 + 23.3.32.21.5.14.10.17.1 + 23.31.27.16.8.30.20.27 + 23.32.5.25.19.9.15.17.15.11 + 23.5.5.17 + 23.5.7.12.11.23.10 + 23.6.27 + 23.8.13.22.21 + 24.1.10.20.28.18.6.27.20.30.26 + 24.1.29.32.14.15.32.6.15.22 + 24.10.10.31.4.29.9 + 24.10.8.25.16 + 24.11.5 + 24.12 + 24.13.1.8 + 24.15.15.17.22 + 24.16.27.10.9 + 24.17.24 + 24.17.31.20.12.9.19.29.18 + 24.18.16 + 24.2.26.24.14.15.31.23.17.26 + 24.2.6.7.16.7.28 + 24.20.23 + 24.21.14.25.11.3.20.6.6.16 + 24.23.24.4.15.25.17 + 24.23.29.8.24.11.21.10.28.14.27 + 24.24 + 24.25.7.27.30.8.26.17 + 24.27.14 + 24.27.18.32.14.9.11.28.9 + 24.28.13.26.8.8.31 + 24.28.32.21 + 24.3.23.25 + 24.31 + 24.31.2.13.5.23.18.16 + 24.31.8 + 24.32.17.23.24.19.23.9.20.18 + 24.32.27 + 24.9 + 24.9.15.1.14.29.6.4 + 24.9.27.16.20.21 + 24.9.8.12.29 + 25.10 + 25.10.29.3.6.21.3.31.13 + 25.10.4.28.3.31.19 + 25.11.24 + 25.14.5.32.25 + 25.15.11 + 25.16.9.6 + 25.17.18.17.27 + 25.17.18.30 + 25.17.2.20.20.3.29.21.3.12 + 25.17.9.16.17.31.23.29.24 + 25.18.8.3.23.23.5.9.6 + 25.19.27.2.9.20 + 25.2.11.20.8.6.22 + 25.2.3.15.11.19.5.28.25.14 + 25.21.8.17 + 25.22.2.25.6 + 25.24.2.32.14.18.16 + 25.24.29 + 25.28.3 + 25.28.30.24 + 25.29 + 25.3 + 25.30.1.4.24.11 + 25.31 + 25.32.24.24.28.15.16.10 + 25.4.32 + 25.4.4.1.13.32.26.20.20.3 + 25.5.30.7.16.12.21.12.11.16 + 25.6 + 25.6.12.16.1 + 25.7.3.21.31.12.28 + 25.9 + 25.9.1.5.9.11.25.4.11.27.32 + 25.9.10 + 26.11 + 26.12.27.2 + 26.13.4.7.13.11.3 + 26.14 + 26.14.5.32.10 + 26.16.12 + 26.16.12.3.27.9.28 + 26.17.9.13.4.25.32.2.24.9 + 26.18 + 26.18.32.20 + 26.19.3.14.8.28.31.10 + 26.24 + 26.24.9.12.11.15.31.2 + 26.25.10.10.13 + 26.25.24 + 26.26.22.21.14.11.29.19.14.24 + 26.28.14 + 26.31.11.23.3 + 26.31.16.18.22.13.32.23.9.20 + 26.31.6.8.29.8.24 + 26.31.7 + 26.32.21.31.27.12 + 26.32.8.12.30.19.24.8.6.1.10 + 26.5.29.7.28 + 26.7.22.3.18.21.11 + 26.7.5.8.11.9.22.1.6 + 26.8.28 + 26.9.17.1.18.19.1.11.18.29.3 + 26.9.20.12.22.22.32 + 27.1.11.3.25.9.6.6 + 27.11.14.17.24 + 27.11.15.9.24.31.18.4.1.30.20 + 27.12.4.2.29.22.15 + 27.15.15.15 + 27.16 + 27.17.15.7.28.20 + 27.17.17.19.24.9.14.20 + 27.17.3.18.2.13.18 + 27.18 + 27.18.10.4.22 + 27.19.20.1.31.29.5.22.26.3 + 27.2.10.4.25.14.2.15.4 + 27.21.27.5.13.30.17 + 27.21.28.24.7.2.24.23.8 + 27.22.11.13.21.25.5.1.27.21.27 + 27.23.2.32.11.21 + 27.23.20.30.7 + 27.24.11.31.21.6.29.17.24.18 + 27.25 + 27.26.29 + 27.27 + 27.27.25.10.31.10.21.22.21.16.12 + 27.27.30.11.15.24.9.7.4.30 + 27.29.1.5.30.6.22.16.23.2.28 + 27.3 + 27.3.3.11.21.4.25 + 27.30.12.11.20.15.11.13 + 27.31.2.16.29.6 + 27.32.26.21.31.17.32.32 + 27.4 + 27.4.15.14.19.6.12 + 27.4.17.17.32.8.16.15.17.13 + 27.5.15.1.15.16.21 + 27.5.22 + 27.6.13.24.21.27.28.22.3.7.4 + 28.1.3 + 28.11.11.30.20.11.32 + 28.11.27.21.14.16 + 28.14.24.26.6.15.16.32.25.13.8 + 28.14.32.29.2.3.4 + 28.15.18.27 + 28.15.25.7.13.6.19.2 + 28.17.26.9 + 28.18.6.22.13.8.25 + 28.2.27.1.20 + 28.20.8.9.9.28.30.29 + 28.23.2.30.3.8.1.15.15.14.13 + 28.25.10.25.19.15 + 28.25.11.22 + 28.25.29.4.13.5.6 + 28.26.25.7 + 28.26.26.6.31 + 28.26.4.22.13.20.32.27.15 + 28.27.24.14 + 28.28 + 28.30.24.16.17.28.2.13.10 + 28.31.10.28.22.26.16.15 + 28.4 + 28.5.12.9.2.27.11.11.2 + 28.5.13 + 28.6 + 28.6.11.6.15.22.12.6 + 28.6.8.22.25 + 28.8.21.15.16.28.4.16.26.8 + 28.9.3.16.17.21.23.30 + 29.1 + 29.1.2.14.14 + 29.1.7.26.25.11.22 + 29.10.12.17.12.16 + 29.10.17.11.28.12.18.5.19.15.21 + 29.11.20.22.27 + 29.14.12.9.17.5.32 + 29.14.31.25.7.32.23 + 29.15.29.8.31.26.1 + 29.20.1.11.21.16.1.2.14.28 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 29.25.29.16.32.11.15.25.5.22.3 + 29.25.30.15.21.3.25.26.26 + 29.26.25.14.24.18.2.13.23.29 + 29.27 + 29.27.13.29.10.2 + 29.27.13.9.28.29.19.13.29.31.27 + 29.27.5.22.26 + 29.27.7.7.3.11.14.26.21.11 + 29.28.9.15.8.27.31 + 29.29.17.31 + 29.29.18 + 29.3.15.17.12.29 + 29.3.17.17.18.32 + 29.30.21.8.16.23.32 + 29.30.7.31.22 + 29.32.13.4.1.16.20 + 29.5.18.27.3.21.18.6.14 + 29.5.32.20.11.7.13.24.17 + 29.6.12.31.20.23.32.20 + 29.9.25.27.15.16.32.26.6.32 + 3.1.13.22.24.14.12.31.3.4 + 3.1.14.8.9.16.30.22.20 + 3.10 + 3.10.27.4.5.6.19.12.28.12 + 3.10.4.5.28.11 + 3.11.18.21.5.20.30 + 3.11.32.11.22.3.7.17.8.13.23 + 3.13 + 3.14.1.14.17.28.29.16 + 3.14.11.15.21.32.2.15.13 + 3.14.30.5.32.22.29 + 3.15.2.23.22.2.16.14 + 3.18 + 3.18.18 + 3.18.8.22.7.28.32.31.3 + 3.19.11.6.5 + 3.20.16.13.29.20 + 3.20.19.10.17.27.3.6.22.23 + 3.21.16.24.23.12.16.32.3 + 3.21.6.13.12.18.25 + 3.22.18.1.5.14.9.6.14 + 3.25 + 3.26 + 3.26.32 + 3.27.18.8.4.21.6.32.30.7.5 + 3.29.19.2.24 + 3.29.32.26.8.10.25 + 3.3 + 3.32.2.29.3.32.28.11.29.30 + 3.4.22.19 + 3.5 + 3.6.24.21.20.32.3.4.26.5 + 3.9.11.23.32.26.24.28 + 3.9.25.26.7 + 30.12.28.2 + 30.12.6.30 + 30.12.9.25.24.6.7.24.29 + 30.15 + 30.16.14.9.5.4.10.7.31 + 30.16.3.21.10 + 30.17.2.25 + 30.17.25.3.31.11.3.4.1.10 + 30.17.4.5.13.6 + 30.18.30.16.29 + 30.2.17.8.14 + 30.20.3.2.5.15.8.7.17 + 30.22.29.21.19.14.3.2.6 + 30.23.10.1.10.7.22.28.18.11.17 + 30.23.2.13.14.15.29.19.4.12.24 + 30.24 + 30.24.23.25.32.18.22.12.29.9.22 + 30.24.32.15.14.10.11 + 30.25 + 30.25.17.17.10.29 + 30.25.24.22 + 30.25.8.24.6.29.31 + 30.27.8.6.11.19 + 30.3.16.26.7.27.26.9.27.21.18 + 30.30.17.5.30.21.19.5.22.22.14 + 30.31.13.9 + 30.32 + 30.4.30.11.13.23.14.24.11 + 30.5 + 30.6.4 + 30.8.18.5.20.6.15 + 30.8.9.14.25.30 + 30.9.24 + 31.13 + 31.13.9.1.5.12 + 31.17 + 31.17.2.30.11 + 31.18 + 31.18.25.1.14.29.25.5.22.30 + 31.18.27.15.20.29.29 + 31.18.32.11.7.25.20.5 + 31.21.14.20.1.22.2.5.3.27.12 + 31.21.22.14.8.21 + 31.24.26.18 + 31.28.32.4.31.4.7 + 31.29.18.26.1.26.17 + 31.29.4.29.24.30.30.32.10.23 + 31.30.12.20 + 31.30.23.7.7.24.32.10.11.1.31 + 31.32.12.26.31.32.14.23.28 + 31.4.7 + 31.5.6.4.8.29.3 + 31.7.14.2 + 31.9.3.5 + 32.1.21.1.16.29.21 + 32.1.23.20.14.12.23.5.32.15 + 32.1.24.29.22.5.9.24.18.3.13 + 32.1.31 + 32.15.20.28.5.1.23.4 + 32.16 + 32.17.8.24.2.14.5.4.22 + 32.19.20.24.23.31.8.32.16.29 + 32.2.11 + 32.24.11.8.12.23.22.19.11.17.18 + 32.24.29.6 + 32.25.16 + 32.25.3.6 + 32.27.13.6.7 + 32.27.18.7.3.4.2 + 32.28.1.32.28.10 + 32.29.24.31.25.6.9 + 32.3.12.2 + 32.3.23.7.2 + 32.3.5.9.17.15 + 32.30.18.17.1.14.12.18 + 32.31.11.22.1 + 32.31.26.19.13.29.4.25 + 32.4.19 + 32.6.13.8.32 + 32.6.15.26.14.15.3.19 + 32.6.3.2.12.5.28.1.25 + 32.6.31.31 + 32.6.8 + 32.6.9.26.16.4.4.29.7.11 + 32.8.29.18.31 + 32.8.5 + 4.1.24.24.28.24.18 + 4.10.28 + 4.11.19.17.2.22.20.18.13.32.15 + 4.11.22.4.19.24.4.28.6.8.22 + 4.13 + 4.13.22.11.9.13.27.15.7 + 4.14 + 4.14.10.19.16 + 4.14.16.14.1.8.1.22.17.10 + 4.14.17.12.20.17.1.22.3 + 4.14.32 + 4.15.20.23.12.16.2.16.17 + 4.16.22.19.24.21 + 4.16.7.25.21.7 + 4.18.29.9.16.10 + 4.19.16.15.5.2.25.8.28.14.2 + 4.2.16.13.16.11.19.10.10.25 + 4.2.2.32.24.25.31.3 + 4.2.6.20.7.8 + 4.21.28.5.16.29.5.21 + 4.21.9.1.2.14.8.17.13.26 + 4.22 + 4.22.17.10.19.9.8.19.28.3.9 + 4.22.7.19.25 + 4.25.12.10.15.9.18.9 + 4.26.2.2 + 4.26.23.6.19.31.10.4.22 + 4.26.5.26.21.28.17.24.25.23 + 4.27.32.18 + 4.3.20.27.9.1.18.30.12.5.19 + 4.3.6.27.22.23.10 + 4.30.8.20.19.9.30.24.11 + 4.31 + 4.5.9.4.15.19.8.26.17.26.3 + 4.7.1 + 4.9 + 5.1.5.31 + 5.10 + 5.10.2.11.21.9.19 + 5.10.3.9.23.30.23 + 5.12.2.20.1.24.25 + 5.13.23.19.28.26.27.6.1.22 + 5.13.23.4.9 + 5.14.27.15.11.17.3.10.27.25 + 5.14.29.2.23.16.20.22 + 5.15.10.3.23.13.32.23 + 5.15.16 + 5.18.9.25.31.21.22 + 5.19.1.26.20.6.20 + 5.2.32.19.13.29.12.13.31.29 + 5.20 + 5.21.27.13.14.11.2.16.20 + 5.23.31.18.24.32 + 5.24.24.9.32.26.31 + 5.24.25.15.27.30.20 + 5.24.4.31.3.16.25.17.13.26.11 + 5.27.16.3.30 + 5.27.21.1.29.29.28 + 5.27.28.26.14.15.6.20.1.31.13 + 5.27.32.21.5.1.11.14 + 5.3.17.29 + 5.3.29.9.22 + 5.31.8.1.5.13.21.28.29.19.2 + 5.4.8.25.12.27.2.29.28.3 + 5.5.12.31.23.13.17.22.20 + 5.8 + 5.8.17.30.15.8.19.29.30.11.6 + 5.9.19.6 + 6.1.8.6.30.29.30 + 6.10.25.12 + 6.11.11.5.16.8.14.12.9 + 6.11.31.23.12.8.30.14.27 + 6.13.31.5.7.26 + 6.14 + 6.17.10.10.7.9.27.8.29 + 6.17.26.25.27.11.10.9 + 6.18.1.4.18.23 + 6.19.29.11.2.32.21.15.32.9 + 6.19.3 + 6.19.6.4.9.11.32.17.17.3.15 + 6.2.32 + 6.20 + 6.20.14 + 6.21.30.7 + 6.22.12 + 6.25.17.32 + 6.26 + 6.26.29.10.21.28.20.19 + 6.27.26.1.20.24.6 + 6.27.29.14.8.12.26.3.21.4.1 + 6.29.32.13.30.3.16 + 6.29.6.13.14.24.10.4.14.28 + 6.5.27.19.13.26.1.18.9 + 6.6.22.8 + 6.7.25.16.13.21.7.20.25.12.4 + 6.7.7 + 6.8.7.20.2 + 6.9.1.10.10.22.6 + 6.9.29.17.4.32 + 7.10.17.21.11.29.17.25.19.4.29 + 7.11 + 7.12 + 7.12.1.10.6.17.29.24.24.4 + 7.12.23 + 7.13 + 7.13.15 + 7.14.22.29.30.14.25.1.9.26.25 + 7.16.20.17 + 7.19.10.12.31.1.27.13.19 + 7.19.12.3.21.19.18.5.2.14.10 + 7.19.6.17.15.26.21.9 + 7.21.8 + 7.23.1.24.29.13.31.19.23.17.7 + 7.23.15.32.28.27.2.2.26 + 7.26.18 + 7.27.20 + 7.30.19.25.23.15.14.29 + 7.30.5.10.10.5.30.14.9.18 + 7.31 + 7.31.2.28.15.11.17.18.19.23.6 + 7.31.4.20.17 + 7.32.10.3.30.12.14 + 7.5.28.8.17.26.31.10.15 + 7.7 + 7.7.22.24.17.32.17.25.28 + 7.7.25.22.22.26 + 8.1.29.18.22 + 8.10 + 8.11.20 + 8.12.4 + 8.13.1 + 8.13.14.11.11.29.22.4.4.10 + 8.13.6.12.18.7 + 8.13.9.31.20.20.24.7.23.31.28 + 8.14.19.18 + 8.16 + 8.16.1.16.28.6.3.22.6.23 + 8.16.20.24.20.6.10.21 + 8.16.30.29.19.22.28.24.2 + 8.16.6 + 8.17.25.26.15.25 + 8.17.9.15.21.28.1.7.1.3.6 + 8.2 + 8.2.18.23.5.16.17.1 + 8.21.17.3.6.3.18 + 8.21.8.23.4.18 + 8.22.32.17.16.28.31.23.22.9 + 8.24.11.13.25.19 + 8.25.20.3.15.24.7.4.24.5.30 + 8.26.29.13.7.25.31.28.3.32 + 8.27.3.4.12.26.16 + 8.29.6.3 + 8.3.18.13.30.20.27.26.17.28 + 8.3.3.25.25.15.7.13.21.18 + 8.31.22.27 + 8.32.30.1 + 8.5.24.9.29.32.31.30.13.9.7 + 8.5.30.29.9.31 + 8.6.6.5.8.8.12 + 8.9.21.16.29 + 8.9.22 + 8.9.25.25.26.30.31.31.2.32.7 + 9.10.19.18.15.11.22.32.32.14.9 + 9.10.32 + 9.14.27.31.26.21.25.3.20 + 9.16.2.16.22.24.17.31.14.21.17 + 9.17.13.31.7 + 9.18.23 + 9.18.30.11.29.32.7.19.2 + 9.19.7.13.13.25 + 9.2.10.4 + 9.2.4.27.26 + 9.21.14.19 + 9.21.20.29.1 + 9.21.28.8.12.15.3.13.10.11 + 9.22.10.15.5.15 + 9.23.21.22.5.29.15.21 + 9.26.1.16 + 9.28.10.26.14.26.15.14 + 9.28.24 + 9.28.30.1.6.25.17.9 + 9.3.3 + 9.3.31.18.12.3.9.29.10 + 9.30 + 9.31.23.19.5.10.16.4.30.24.5 + 9.31.4.14.31.10.17.5.2 + 9.5 + 9.5.9.3.23.9.25.14.1.29.28 + 9.6.9.21.6.11.29.13.29.20.32 + 9.7.31.11.8.23 + 9.8.23.2.20.16 + 9.9.13.9.14.27 +(882 rows) + +SELECT * FROM ltreetest WHERE t @> '1.1.1' order by t asc; + t +------- + + 1 + 1.1 + 1.1.1 +(4 rows) + +SELECT * FROM ltreetest WHERE t <@ '1.1.1' order by t asc; + t +----------- + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 +(4 rows) + +SELECT * FROM ltreetest WHERE t @ '23 & 1' order by t asc; + t +-------------------------------- + 1.10.23.25.5.11 + 1.10.4.18.22.23.24 + 1.12.25.26.22.8.15.23 + 1.19.22.11.14.7.32.23.19.14 + 1.21.28.4.23 + 1.26.15.23.5.31.29.11.19.28.1 + 1.27.22.23.2.26.32.17.7.9 + 10.12.9.6.6.26.14.8.23.1.25 + 12.27.23.32.1.1.9.29.13 + 14.1.15.25.27.23.25.26.28.10 + 14.27.29.23.4.1.17.32.6.25.22 + 15.11.26.1.30.6.23.5 + 19.22.29.32.1.21.26.24.23.17 + 19.9.32.23.13.24.1 + 21.23.17.8.23.11.8.1 + 22.30.31.24.23.22.5.20.28.1 + 23.1.23.18.12.29 + 23.12.1.5.32.25.8.24.1.25 + 23.12.32.22.19.1.22.4 + 23.17.22.1.23.4.29.32.4.1 + 23.17.25.4.1.16.29.10 + 23.19.17.31.29.13.1.12.5.25 + 23.22.10.1.14.24 + 23.28.1 + 23.3.32.21.5.14.10.17.1 + 27.29.1.5.30.6.22.16.23.2.28 + 28.23.2.30.3.8.1.15.15.14.13 + 29.23.1.21.31.8 + 29.23.15.25.1.6.6.10 + 30.23.10.1.10.7.22.28.18.11.17 + 31.30.23.7.7.24.32.10.11.1.31 + 32.1.23.20.14.12.23.5.32.15 + 32.15.20.28.5.1.23.4 + 5.13.23.19.28.26.27.6.1.22 + 6.18.1.4.18.23 + 7.23.1.24.29.13.31.19.23.17.7 + 8.16.1.16.28.6.3.22.6.23 + 8.2.18.23.5.16.17.1 + 9.5.9.3.23.9.25.14.1.29.28 +(39 rows) + +SELECT * FROM ltreetest WHERE t ~ '1.1.1.*' order by t asc; + t +----------- + 1.1.1 + 1.1.1.1 + 1.1.1.2 + 1.1.1.2.1 +(4 rows) + +SELECT * FROM ltreetest WHERE t ~ '*.1' order by t asc; + t +-------------------------------- + 1 + 1.1 + 1.1.1 + 1.1.1.1 + 1.1.1.2.1 + 1.1.2.1 + 1.26.15.23.5.31.29.11.19.28.1 + 10.13.22.1.8.30.9.24.1.2.1 + 10.22.1 + 10.26.30.15.1 + 11.1 + 12.1.1 + 17.25.2.13.10.27.13.1 + 18.13.6.12.26.26.26.29.18.20.1 + 19.20.25.7.27.28.27.17.9.3.1 + 19.9.32.23.13.24.1 + 20.17.18.21.1 + 20.4.27.31.1 + 21.18.2.1 + 21.23.17.8.23.11.8.1 + 22.30.31.24.23.22.5.20.28.1 + 23.17.22.1.23.4.29.32.4.1 + 23.28.1 + 23.3.32.21.5.14.10.17.1 + 25.6.12.16.1 + 29.1 + 29.15.29.8.31.26.1 + 32.31.11.22.1 + 4.7.1 + 6.27.29.14.8.12.26.3.21.4.1 + 8.13.1 + 8.2.18.23.5.16.17.1 + 8.32.30.1 + 9.21.20.29.1 +(34 rows) + +SELECT * FROM ltreetest WHERE t ~ '23.*{1}.1' order by t asc; + t +--------- + 23.28.1 +(1 row) + +SELECT * FROM ltreetest WHERE t ~ '23.*.1' order by t asc; + t +--------------------------- + 23.17.22.1.23.4.29.32.4.1 + 23.28.1 + 23.3.32.21.5.14.10.17.1 +(3 rows) + +SELECT * FROM ltreetest WHERE t ~ '23.*.2' order by t asc; + t +------------------ + 23.20.12.16.15.2 +(1 row) + +SELECT * FROM ltreetest WHERE t ? '{23.*.1,23.*.2}' order by t asc; + t +--------------------------- + 23.17.22.1.23.4.29.32.4.1 + 23.20.12.16.15.2 + 23.28.1 + 23.3.32.21.5.14.10.17.1 +(4 rows) + +drop index tstidx; +create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=0)); +ERROR: value 0 out of bounds for option "siglen" +DETAIL: Valid values are between "1" and "2024". +create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2025)); +ERROR: value 2025 out of bounds for option "siglen" +DETAIL: Valid values are between "1" and "2024". +create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2024)); +SELECT count(*) FROM ltreetest WHERE t < '12.3'; + count +------- + 123 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t <= '12.3'; + count +------- + 124 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t = '12.3'; + count +------- + 1 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t >= '12.3'; + count +------- + 883 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t > '12.3'; + count +------- + 882 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t @> '1.1.1'; + count +------- + 4 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t <@ '1.1.1'; + count +------- + 4 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t @ '23 & 1'; + count +------- + 39 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t ~ '1.1.1.*'; + count +------- + 4 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t ~ '*.1'; + count +------- + 34 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t ~ '23.*{1}.1'; + count +------- + 1 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t ~ '23.*.1'; + count +------- + 3 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t ~ '23.*.2'; + count +------- + 1 +(1 row) + +SELECT count(*) FROM ltreetest WHERE t ? '{23.*.1,23.*.2}'; + count +------- + 4 +(1 row) + +create table _ltreetest (t ltree[]); +\copy _ltreetest FROM 'data/_ltree.data' +SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ; + count +------- + 15 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ; + count +------- + 19 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t @ '23 & 1' ; + count +------- + 147 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '1.1.1.*' ; + count +------- + 19 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '*.1' ; + count +------- + 109 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ; + count +------- + 5 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ; + count +------- + 11 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ; + count +------- + 5 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ; + count +------- + 15 +(1 row) + +create index _tstidx on _ltreetest using gist (t); +set enable_seqscan=off; +SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ; + count +------- + 15 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ; + count +------- + 19 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t @ '23 & 1' ; + count +------- + 147 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '1.1.1.*' ; + count +------- + 19 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '*.1' ; + count +------- + 109 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ; + count +------- + 5 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ; + count +------- + 11 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ; + count +------- + 5 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ; + count +------- + 15 +(1 row) + +drop index _tstidx; +create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=0)); +ERROR: value 0 out of bounds for option "siglen" +DETAIL: Valid values are between "1" and "2024". +create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2025)); +ERROR: value 2025 out of bounds for option "siglen" +DETAIL: Valid values are between "1" and "2024". +create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2024)); +SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ; + count +------- + 15 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ; + count +------- + 19 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t @ '23 & 1' ; + count +------- + 147 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '1.1.1.*' ; + count +------- + 19 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '*.1' ; + count +------- + 109 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ; + count +------- + 5 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ; + count +------- + 11 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ; + count +------- + 5 +(1 row) + +SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ; + count +------- + 15 +(1 row) + diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c new file mode 100644 index 0000000..ef86046 --- /dev/null +++ b/contrib/ltree/lquery_op.c @@ -0,0 +1,281 @@ +/* + * op function for ltree and lquery + * Teodor Sigaev <teodor@stack.net> + * contrib/ltree/lquery_op.c + */ +#include "postgres.h" + +#include <ctype.h> + +#include "catalog/pg_collation.h" +#include "ltree.h" +#include "miscadmin.h" +#include "utils/formatting.h" + +PG_FUNCTION_INFO_V1(ltq_regex); +PG_FUNCTION_INFO_V1(ltq_rregex); + +PG_FUNCTION_INFO_V1(lt_q_regex); +PG_FUNCTION_INFO_V1(lt_q_rregex); + +#define NEXTVAL(x) ( (lquery*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) ) + +static char * +getlexeme(char *start, char *end, int *len) +{ + char *ptr; + int charlen; + + while (start < end && (charlen = pg_mblen(start)) == 1 && t_iseq(start, '_')) + start += charlen; + + ptr = start; + if (ptr >= end) + return NULL; + + while (ptr < end && !((charlen = pg_mblen(ptr)) == 1 && t_iseq(ptr, '_'))) + ptr += charlen; + + *len = ptr - start; + return start; +} + +bool +compare_subnode(ltree_level *t, char *qn, int len, int (*cmpptr) (const char *, const char *, size_t), bool anyend) +{ + char *endt = t->name + t->len; + char *endq = qn + len; + char *tn; + int lent, + lenq; + bool isok; + + while ((qn = getlexeme(qn, endq, &lenq)) != NULL) + { + tn = t->name; + isok = false; + while ((tn = getlexeme(tn, endt, &lent)) != NULL) + { + if ((lent == lenq || (lent > lenq && anyend)) && + (*cmpptr) (qn, tn, lenq) == 0) + { + + isok = true; + break; + } + tn += lent; + } + + if (!isok) + return false; + qn += lenq; + } + + return true; +} + +int +ltree_strncasecmp(const char *a, const char *b, size_t s) +{ + char *al = str_tolower(a, s, DEFAULT_COLLATION_OID); + char *bl = str_tolower(b, s, DEFAULT_COLLATION_OID); + int res; + + res = strncmp(al, bl, s); + + pfree(al); + pfree(bl); + + return res; +} + +/* + * See if an lquery_level matches an ltree_level + * + * This accounts for all flags including LQL_NOT, but does not + * consider repetition counts. + */ +static bool +checkLevel(lquery_level *curq, ltree_level *curt) +{ + lquery_variant *curvar = LQL_FIRST(curq); + bool success; + + success = (curq->flag & LQL_NOT) ? false : true; + + /* numvar == 0 means '*' which matches anything */ + if (curq->numvar == 0) + return success; + + for (int i = 0; i < curq->numvar; i++) + { + int (*cmpptr) (const char *, const char *, size_t); + + cmpptr = (curvar->flag & LVAR_INCASE) ? ltree_strncasecmp : strncmp; + + if (curvar->flag & LVAR_SUBLEXEME) + { + if (compare_subnode(curt, curvar->name, curvar->len, cmpptr, + (curvar->flag & LVAR_ANYEND))) + return success; + } + else if ((curvar->len == curt->len || + (curt->len > curvar->len && (curvar->flag & LVAR_ANYEND))) && + (*cmpptr) (curvar->name, curt->name, curvar->len) == 0) + return success; + + curvar = LVAR_NEXT(curvar); + } + return !success; +} + +/* + * Try to match an lquery (of qlen items) to an ltree (of tlen items) + */ +static bool +checkCond(lquery_level *curq, int qlen, + ltree_level *curt, int tlen) +{ + /* Since this function recurses, it could be driven to stack overflow */ + check_stack_depth(); + + /* Pathological patterns could take awhile, too */ + CHECK_FOR_INTERRUPTS(); + + /* Loop while we have query items to consider */ + while (qlen > 0) + { + int low, + high; + lquery_level *nextq; + + /* + * Get min and max repetition counts for this query item, dealing with + * the backwards-compatibility hack that the low/high fields aren't + * meaningful for non-'*' items unless LQL_COUNT is set. + */ + if ((curq->flag & LQL_COUNT) || curq->numvar == 0) + low = curq->low, high = curq->high; + else + low = high = 1; + + /* + * We may limit "high" to the remaining text length; this avoids + * separate tests below. + */ + if (high > tlen) + high = tlen; + + /* Fail if a match of required number of items is impossible */ + if (high < low) + return false; + + /* + * Recursively check the rest of the pattern against each possible + * start point following some of this item's match(es). + */ + nextq = LQL_NEXT(curq); + qlen--; + + for (int matchcnt = 0; matchcnt < high; matchcnt++) + { + /* + * If we've consumed an acceptable number of matches of this item, + * and the rest of the pattern matches beginning here, we're good. + */ + if (matchcnt >= low && checkCond(nextq, qlen, curt, tlen)) + return true; + + /* + * Otherwise, try to match one more text item to this query item. + */ + if (!checkLevel(curq, curt)) + return false; + + curt = LEVEL_NEXT(curt); + tlen--; + } + + /* + * Once we've consumed "high" matches, we can succeed only if the rest + * of the pattern matches beginning here. Loop around (if you prefer, + * think of this as tail recursion). + */ + curq = nextq; + } + + /* + * Once we're out of query items, we match only if there's no remaining + * text either. + */ + return (tlen == 0); +} + +Datum +ltq_regex(PG_FUNCTION_ARGS) +{ + ltree *tree = PG_GETARG_LTREE_P(0); + lquery *query = PG_GETARG_LQUERY_P(1); + bool res; + + res = checkCond(LQUERY_FIRST(query), query->numlevel, + LTREE_FIRST(tree), tree->numlevel); + + PG_FREE_IF_COPY(tree, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +ltq_rregex(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(ltq_regex, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} + +Datum +lt_q_regex(PG_FUNCTION_ARGS) +{ + ltree *tree = PG_GETARG_LTREE_P(0); + ArrayType *_query = PG_GETARG_ARRAYTYPE_P(1); + lquery *query = (lquery *) ARR_DATA_PTR(_query); + bool res = false; + int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query)); + + if (ARR_NDIM(_query) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + while (num > 0) + { + if (DatumGetBool(DirectFunctionCall2(ltq_regex, + PointerGetDatum(tree), PointerGetDatum(query)))) + { + + res = true; + break; + } + num--; + query = NEXTVAL(query); + } + + PG_FREE_IF_COPY(tree, 0); + PG_FREE_IF_COPY(_query, 1); + PG_RETURN_BOOL(res); +} + +Datum +lt_q_rregex(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(lt_q_regex, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} diff --git a/contrib/ltree/ltree--1.0--1.1.sql b/contrib/ltree/ltree--1.0--1.1.sql new file mode 100644 index 0000000..2ce6f5a --- /dev/null +++ b/contrib/ltree/ltree--1.0--1.1.sql @@ -0,0 +1,115 @@ +/* contrib/ltree/ltree--1.0--1.1.sql */ + +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ltree UPDATE TO '1.1'" to load this file. \quit + +-- Update procedure signatures the hard way. +-- We use to_regprocedure() so that query doesn't fail if run against 9.6beta1 definitions, +-- wherein the signatures have been updated already. In that case to_regprocedure() will +-- return NULL and no updates will happen. +DO LANGUAGE plpgsql +$$ +DECLARE + my_schema pg_catalog.text := pg_catalog.quote_ident(pg_catalog.current_schema()); + old_path pg_catalog.text := pg_catalog.current_setting('search_path'); +BEGIN +-- for safety, transiently set search_path to just pg_catalog+pg_temp +PERFORM pg_catalog.set_config('search_path', 'pg_catalog, pg_temp', true); + +UPDATE pg_catalog.pg_proc SET + proargtypes = pg_catalog.array_to_string(newtypes::pg_catalog.oid[], ' ')::pg_catalog.oidvector, + pronargs = pg_catalog.array_length(newtypes, 1) +FROM (VALUES +(NULL::pg_catalog.text, NULL::pg_catalog.text[]), -- establish column types +('ltree_consistent(internal,internal,int2,oid,internal)', '{internal,SCH.ltree,int2,oid,internal}'), +('ltree_same(internal,internal,internal)', '{SCH.ltree_gist,SCH.ltree_gist,internal}'), +('_ltree_consistent(internal,internal,int2,oid,internal)', '{internal,SCH._ltree,int2,oid,internal}'), +('_ltree_same(internal,internal,internal)', '{SCH.ltree_gist,SCH.ltree_gist,internal}') +) AS update_data (oldproc, newtypestext), +LATERAL ( + SELECT array_agg(replace(typ, 'SCH', my_schema)::regtype) as newtypes FROM unnest(newtypestext) typ +) ls +WHERE oid = to_regprocedure(my_schema || '.' || replace(oldproc, 'SCH', my_schema)); + +UPDATE pg_catalog.pg_proc SET + prorettype = (my_schema || '.ltree_gist')::pg_catalog.regtype +WHERE oid = pg_catalog.to_regprocedure(my_schema || '.ltree_union(internal,internal)'); + +UPDATE pg_catalog.pg_proc SET + prorettype = (my_schema || '.ltree_gist')::pg_catalog.regtype +WHERE oid = pg_catalog.to_regprocedure(my_schema || '._ltree_union(internal,internal)'); + +PERFORM pg_catalog.set_config('search_path', old_path, true); +END +$$; + +ALTER FUNCTION ltree_in(cstring) PARALLEL SAFE; +ALTER FUNCTION ltree_out(ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_cmp(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_lt(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_le(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_eq(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_ge(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_gt(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_ne(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION subltree(ltree, int4, int4) PARALLEL SAFE; +ALTER FUNCTION subpath(ltree, int4, int4) PARALLEL SAFE; +ALTER FUNCTION subpath(ltree, int4) PARALLEL SAFE; +ALTER FUNCTION index(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION index(ltree, ltree, int4) PARALLEL SAFE; +ALTER FUNCTION nlevel(ltree) PARALLEL SAFE; +ALTER FUNCTION ltree2text(ltree) PARALLEL SAFE; +ALTER FUNCTION text2ltree(text) PARALLEL SAFE; +ALTER FUNCTION lca(_ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree, ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree, ltree, ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree, ltree, ltree, ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree, ltree, ltree, ltree, ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION lca(ltree, ltree, ltree, ltree, ltree, ltree, ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_isparent(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_risparent(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_addltree(ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_addtext(ltree, text) PARALLEL SAFE; +ALTER FUNCTION ltree_textadd(text, ltree) PARALLEL SAFE; +ALTER FUNCTION ltreeparentsel(internal, oid, internal, integer) PARALLEL SAFE; +ALTER FUNCTION lquery_in(cstring) PARALLEL SAFE; +ALTER FUNCTION lquery_out(lquery) PARALLEL SAFE; +ALTER FUNCTION ltq_regex(ltree, lquery) PARALLEL SAFE; +ALTER FUNCTION ltq_rregex(lquery, ltree) PARALLEL SAFE; +ALTER FUNCTION lt_q_regex(ltree, _lquery) PARALLEL SAFE; +ALTER FUNCTION lt_q_rregex(_lquery, ltree) PARALLEL SAFE; +ALTER FUNCTION ltxtq_in(cstring) PARALLEL SAFE; +ALTER FUNCTION ltxtq_out(ltxtquery) PARALLEL SAFE; +ALTER FUNCTION ltxtq_exec(ltree, ltxtquery) PARALLEL SAFE; +ALTER FUNCTION ltxtq_rexec(ltxtquery, ltree) PARALLEL SAFE; +ALTER FUNCTION ltree_gist_in(cstring) PARALLEL SAFE; +ALTER FUNCTION ltree_gist_out(ltree_gist) PARALLEL SAFE; +ALTER FUNCTION ltree_consistent(internal, ltree, int2, oid, internal) PARALLEL SAFE; +ALTER FUNCTION ltree_compress(internal) PARALLEL SAFE; +ALTER FUNCTION ltree_decompress(internal) PARALLEL SAFE; +ALTER FUNCTION ltree_penalty(internal, internal, internal) PARALLEL SAFE; +ALTER FUNCTION ltree_picksplit(internal, internal) PARALLEL SAFE; +ALTER FUNCTION ltree_union(internal, internal) PARALLEL SAFE; +ALTER FUNCTION ltree_same(ltree_gist, ltree_gist, internal) PARALLEL SAFE; +ALTER FUNCTION _ltree_isparent(_ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION _ltree_r_isparent(ltree, _ltree) PARALLEL SAFE; +ALTER FUNCTION _ltree_risparent(_ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION _ltree_r_risparent(ltree, _ltree) PARALLEL SAFE; +ALTER FUNCTION _ltq_regex(_ltree, lquery) PARALLEL SAFE; +ALTER FUNCTION _ltq_rregex(lquery, _ltree) PARALLEL SAFE; +ALTER FUNCTION _lt_q_regex(_ltree, _lquery) PARALLEL SAFE; +ALTER FUNCTION _lt_q_rregex(_lquery, _ltree) PARALLEL SAFE; +ALTER FUNCTION _ltxtq_exec(_ltree, ltxtquery) PARALLEL SAFE; +ALTER FUNCTION _ltxtq_rexec(ltxtquery, _ltree) PARALLEL SAFE; +ALTER FUNCTION _ltree_extract_isparent(_ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION _ltree_extract_risparent(_ltree, ltree) PARALLEL SAFE; +ALTER FUNCTION _ltq_extract_regex(_ltree, lquery) PARALLEL SAFE; +ALTER FUNCTION _ltxtq_extract_exec(_ltree, ltxtquery) PARALLEL SAFE; +ALTER FUNCTION _ltree_consistent(internal, _ltree, int2, oid, internal) PARALLEL SAFE; +ALTER FUNCTION _ltree_compress(internal) PARALLEL SAFE; +ALTER FUNCTION _ltree_penalty(internal, internal, internal) PARALLEL SAFE; +ALTER FUNCTION _ltree_picksplit(internal, internal) PARALLEL SAFE; +ALTER FUNCTION _ltree_union(internal, internal) PARALLEL SAFE; +ALTER FUNCTION _ltree_same(ltree_gist, ltree_gist, internal) PARALLEL SAFE; diff --git a/contrib/ltree/ltree--1.1--1.2.sql b/contrib/ltree/ltree--1.1--1.2.sql new file mode 100644 index 0000000..e38e76b --- /dev/null +++ b/contrib/ltree/ltree--1.1--1.2.sql @@ -0,0 +1,139 @@ +/* contrib/ltree/ltree--1.1--1.2.sql */ + +-- complain if script is sourced in psql, rather than via ALTER EXTENSION +\echo Use "ALTER EXTENSION ltree UPDATE TO '1.2'" to load this file. \quit + +CREATE FUNCTION ltree_recv(internal) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_send(ltree) +RETURNS bytea +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +ALTER TYPE ltree SET ( RECEIVE = ltree_recv, SEND = ltree_send ); + +CREATE FUNCTION lquery_recv(internal) +RETURNS lquery +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lquery_send(lquery) +RETURNS bytea +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +ALTER TYPE lquery SET ( RECEIVE = lquery_recv, SEND = lquery_send ); + +CREATE FUNCTION ltxtq_recv(internal) +RETURNS ltxtquery +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltxtq_send(ltxtquery) +RETURNS bytea +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +ALTER TYPE ltxtquery SET ( RECEIVE = ltxtq_recv, SEND = ltxtq_send ); + + +CREATE FUNCTION ltree_gist_options(internal) +RETURNS void +AS 'MODULE_PATHNAME', 'ltree_gist_options' +LANGUAGE C IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltree_gist_options(internal) +RETURNS void +AS 'MODULE_PATHNAME', '_ltree_gist_options' +LANGUAGE C IMMUTABLE PARALLEL SAFE; + +ALTER OPERATOR FAMILY gist_ltree_ops USING gist +ADD FUNCTION 10 (ltree) ltree_gist_options (internal); + +ALTER OPERATOR FAMILY gist__ltree_ops USING gist +ADD FUNCTION 10 (_ltree) _ltree_gist_options (internal); + +ALTER OPERATOR < (ltree, ltree) + SET (RESTRICT = scalarltsel, JOIN = scalarltjoinsel); +ALTER OPERATOR <= (ltree, ltree) + SET (RESTRICT = scalarlesel, JOIN = scalarlejoinsel); +ALTER OPERATOR >= (ltree, ltree) + SET (RESTRICT = scalargesel, JOIN = scalargejoinsel); +ALTER OPERATOR > (ltree, ltree) + SET (RESTRICT = scalargtsel, JOIN = scalargtjoinsel); + +ALTER OPERATOR @> (ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@> (ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR <@ (ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^<@ (ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ~ (ltree, lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ~ (lquery, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^~ (ltree, lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^~ (lquery, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ? (ltree, _lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ? (_lquery, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^? (ltree, _lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^? (_lquery, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR @ (ltree, ltxtquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR @ (ltxtquery, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@ (ltree, ltxtquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@ (ltxtquery, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR @> (_ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR <@ (ltree, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR <@ (_ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR @> (ltree, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ~ (_ltree, lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ~ (lquery, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ? (_ltree, _lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ? (_lquery, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR @ (_ltree, ltxtquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR @ (ltxtquery, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@> (_ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^<@ (ltree, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^<@ (_ltree, ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@> (ltree, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^~ (_ltree, lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^~ (lquery, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^? (_ltree, _lquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^? (_lquery, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@ (_ltree, ltxtquery) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); +ALTER OPERATOR ^@ (ltxtquery, _ltree) + SET (RESTRICT = matchingsel, JOIN = matchingjoinsel); diff --git a/contrib/ltree/ltree--1.1.sql b/contrib/ltree/ltree--1.1.sql new file mode 100644 index 0000000..d46f5fc --- /dev/null +++ b/contrib/ltree/ltree--1.1.sql @@ -0,0 +1,872 @@ +/* contrib/ltree/ltree--1.1.sql */ + +-- complain if script is sourced in psql, rather than via CREATE EXTENSION +\echo Use "CREATE EXTENSION ltree" to load this file. \quit + +CREATE FUNCTION ltree_in(cstring) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_out(ltree) +RETURNS cstring +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE TYPE ltree ( + INTERNALLENGTH = -1, + INPUT = ltree_in, + OUTPUT = ltree_out, + STORAGE = extended +); + + +--Compare function for ltree +CREATE FUNCTION ltree_cmp(ltree,ltree) +RETURNS int4 +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_lt(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_le(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_eq(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_ge(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_gt(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_ne(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + + +CREATE OPERATOR < ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_lt, + COMMUTATOR = '>', + NEGATOR = '>=', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR <= ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_le, + COMMUTATOR = '>=', + NEGATOR = '>', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR >= ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_ge, + COMMUTATOR = '<=', + NEGATOR = '<', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR > ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_gt, + COMMUTATOR = '<', + NEGATOR = '<=', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR = ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_eq, + COMMUTATOR = '=', + NEGATOR = '<>', + RESTRICT = eqsel, + JOIN = eqjoinsel, + SORT1 = '<', + SORT2 = '<' +); + +CREATE OPERATOR <> ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_ne, + COMMUTATOR = '<>', + NEGATOR = '=', + RESTRICT = neqsel, + JOIN = neqjoinsel +); + +--util functions + +CREATE FUNCTION subltree(ltree,int4,int4) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION subpath(ltree,int4,int4) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION subpath(ltree,int4) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION index(ltree,ltree) +RETURNS int4 +AS 'MODULE_PATHNAME', 'ltree_index' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION index(ltree,ltree,int4) +RETURNS int4 +AS 'MODULE_PATHNAME', 'ltree_index' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION nlevel(ltree) +RETURNS int4 +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree2text(ltree) +RETURNS text +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION text2ltree(text) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(_ltree) +RETURNS ltree +AS 'MODULE_PATHNAME','_lca' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree,ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lca(ltree,ltree,ltree,ltree,ltree,ltree,ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_isparent(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_risparent(ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_addltree(ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_addtext(ltree,text) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_textadd(text,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltreeparentsel(internal, oid, internal, integer) +RETURNS float8 +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR @> ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_isparent, + COMMUTATOR = '<@', + RESTRICT = ltreeparentsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^@> ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_isparent, + COMMUTATOR = '^<@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR <@ ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_risparent, + COMMUTATOR = '@>', + RESTRICT = ltreeparentsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^<@ ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_risparent, + COMMUTATOR = '^@>', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR || ( + LEFTARG = ltree, + RIGHTARG = ltree, + PROCEDURE = ltree_addltree +); + +CREATE OPERATOR || ( + LEFTARG = ltree, + RIGHTARG = text, + PROCEDURE = ltree_addtext +); + +CREATE OPERATOR || ( + LEFTARG = text, + RIGHTARG = ltree, + PROCEDURE = ltree_textadd +); + + +-- B-tree support + +CREATE OPERATOR CLASS ltree_ops + DEFAULT FOR TYPE ltree USING btree AS + OPERATOR 1 < , + OPERATOR 2 <= , + OPERATOR 3 = , + OPERATOR 4 >= , + OPERATOR 5 > , + FUNCTION 1 ltree_cmp(ltree, ltree); + + +--lquery type +CREATE FUNCTION lquery_in(cstring) +RETURNS lquery +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lquery_out(lquery) +RETURNS cstring +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE TYPE lquery ( + INTERNALLENGTH = -1, + INPUT = lquery_in, + OUTPUT = lquery_out, + STORAGE = extended +); + +CREATE FUNCTION ltq_regex(ltree,lquery) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltq_rregex(lquery,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR ~ ( + LEFTARG = ltree, + RIGHTARG = lquery, + PROCEDURE = ltq_regex, + COMMUTATOR = '~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ~ ( + LEFTARG = lquery, + RIGHTARG = ltree, + PROCEDURE = ltq_rregex, + COMMUTATOR = '~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +--not-indexed +CREATE OPERATOR ^~ ( + LEFTARG = ltree, + RIGHTARG = lquery, + PROCEDURE = ltq_regex, + COMMUTATOR = '^~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^~ ( + LEFTARG = lquery, + RIGHTARG = ltree, + PROCEDURE = ltq_rregex, + COMMUTATOR = '^~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE FUNCTION lt_q_regex(ltree,_lquery) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION lt_q_rregex(_lquery,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR ? ( + LEFTARG = ltree, + RIGHTARG = _lquery, + PROCEDURE = lt_q_regex, + COMMUTATOR = '?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ? ( + LEFTARG = _lquery, + RIGHTARG = ltree, + PROCEDURE = lt_q_rregex, + COMMUTATOR = '?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +--not-indexed +CREATE OPERATOR ^? ( + LEFTARG = ltree, + RIGHTARG = _lquery, + PROCEDURE = lt_q_regex, + COMMUTATOR = '^?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^? ( + LEFTARG = _lquery, + RIGHTARG = ltree, + PROCEDURE = lt_q_rregex, + COMMUTATOR = '^?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE FUNCTION ltxtq_in(cstring) +RETURNS ltxtquery +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltxtq_out(ltxtquery) +RETURNS cstring +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE TYPE ltxtquery ( + INTERNALLENGTH = -1, + INPUT = ltxtq_in, + OUTPUT = ltxtq_out, + STORAGE = extended +); + +-- operations WITH ltxtquery + +CREATE FUNCTION ltxtq_exec(ltree, ltxtquery) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltxtq_rexec(ltxtquery, ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR @ ( + LEFTARG = ltree, + RIGHTARG = ltxtquery, + PROCEDURE = ltxtq_exec, + COMMUTATOR = '@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR @ ( + LEFTARG = ltxtquery, + RIGHTARG = ltree, + PROCEDURE = ltxtq_rexec, + COMMUTATOR = '@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +--not-indexed +CREATE OPERATOR ^@ ( + LEFTARG = ltree, + RIGHTARG = ltxtquery, + PROCEDURE = ltxtq_exec, + COMMUTATOR = '^@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^@ ( + LEFTARG = ltxtquery, + RIGHTARG = ltree, + PROCEDURE = ltxtq_rexec, + COMMUTATOR = '^@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +--GiST support for ltree +CREATE FUNCTION ltree_gist_in(cstring) +RETURNS ltree_gist +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION ltree_gist_out(ltree_gist) +RETURNS cstring +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE TYPE ltree_gist ( + internallength = -1, + input = ltree_gist_in, + output = ltree_gist_out, + storage = plain +); + + +CREATE FUNCTION ltree_consistent(internal,ltree,int2,oid,internal) +RETURNS bool as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION ltree_compress(internal) +RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION ltree_decompress(internal) +RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION ltree_penalty(internal,internal,internal) +RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION ltree_picksplit(internal, internal) +RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION ltree_union(internal, internal) +RETURNS ltree_gist as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION ltree_same(ltree_gist, ltree_gist, internal) +RETURNS internal as 'MODULE_PATHNAME' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OPERATOR CLASS gist_ltree_ops + DEFAULT FOR TYPE ltree USING gist AS + OPERATOR 1 < , + OPERATOR 2 <= , + OPERATOR 3 = , + OPERATOR 4 >= , + OPERATOR 5 > , + OPERATOR 10 @> , + OPERATOR 11 <@ , + OPERATOR 12 ~ (ltree, lquery) , + OPERATOR 13 ~ (lquery, ltree) , + OPERATOR 14 @ (ltree, ltxtquery) , + OPERATOR 15 @ (ltxtquery, ltree) , + OPERATOR 16 ? (ltree, _lquery) , + OPERATOR 17 ? (_lquery, ltree) , + FUNCTION 1 ltree_consistent (internal, ltree, int2, oid, internal), + FUNCTION 2 ltree_union (internal, internal), + FUNCTION 3 ltree_compress (internal), + FUNCTION 4 ltree_decompress (internal), + FUNCTION 5 ltree_penalty (internal, internal, internal), + FUNCTION 6 ltree_picksplit (internal, internal), + FUNCTION 7 ltree_same (ltree_gist, ltree_gist, internal), + STORAGE ltree_gist; + + +-- arrays of ltree + +CREATE FUNCTION _ltree_isparent(_ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltree_r_isparent(ltree,_ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltree_risparent(_ltree,ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltree_r_risparent(ltree,_ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltq_regex(_ltree,lquery) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltq_rregex(lquery,_ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _lt_q_regex(_ltree,_lquery) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _lt_q_rregex(_lquery,_ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltxtq_exec(_ltree, ltxtquery) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE FUNCTION _ltxtq_rexec(ltxtquery, _ltree) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR @> ( + LEFTARG = _ltree, + RIGHTARG = ltree, + PROCEDURE = _ltree_isparent, + COMMUTATOR = '<@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR <@ ( + LEFTARG = ltree, + RIGHTARG = _ltree, + PROCEDURE = _ltree_r_isparent, + COMMUTATOR = '@>', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR <@ ( + LEFTARG = _ltree, + RIGHTARG = ltree, + PROCEDURE = _ltree_risparent, + COMMUTATOR = '@>', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR @> ( + LEFTARG = ltree, + RIGHTARG = _ltree, + PROCEDURE = _ltree_r_risparent, + COMMUTATOR = '<@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ~ ( + LEFTARG = _ltree, + RIGHTARG = lquery, + PROCEDURE = _ltq_regex, + COMMUTATOR = '~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ~ ( + LEFTARG = lquery, + RIGHTARG = _ltree, + PROCEDURE = _ltq_rregex, + COMMUTATOR = '~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ? ( + LEFTARG = _ltree, + RIGHTARG = _lquery, + PROCEDURE = _lt_q_regex, + COMMUTATOR = '?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ? ( + LEFTARG = _lquery, + RIGHTARG = _ltree, + PROCEDURE = _lt_q_rregex, + COMMUTATOR = '?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR @ ( + LEFTARG = _ltree, + RIGHTARG = ltxtquery, + PROCEDURE = _ltxtq_exec, + COMMUTATOR = '@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR @ ( + LEFTARG = ltxtquery, + RIGHTARG = _ltree, + PROCEDURE = _ltxtq_rexec, + COMMUTATOR = '@', + RESTRICT = contsel, + JOIN = contjoinsel +); + + +--not indexed +CREATE OPERATOR ^@> ( + LEFTARG = _ltree, + RIGHTARG = ltree, + PROCEDURE = _ltree_isparent, + COMMUTATOR = '^<@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^<@ ( + LEFTARG = ltree, + RIGHTARG = _ltree, + PROCEDURE = _ltree_r_isparent, + COMMUTATOR = '^@>', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^<@ ( + LEFTARG = _ltree, + RIGHTARG = ltree, + PROCEDURE = _ltree_risparent, + COMMUTATOR = '^@>', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^@> ( + LEFTARG = ltree, + RIGHTARG = _ltree, + PROCEDURE = _ltree_r_risparent, + COMMUTATOR = '^<@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^~ ( + LEFTARG = _ltree, + RIGHTARG = lquery, + PROCEDURE = _ltq_regex, + COMMUTATOR = '^~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^~ ( + LEFTARG = lquery, + RIGHTARG = _ltree, + PROCEDURE = _ltq_rregex, + COMMUTATOR = '^~', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^? ( + LEFTARG = _ltree, + RIGHTARG = _lquery, + PROCEDURE = _lt_q_regex, + COMMUTATOR = '^?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^? ( + LEFTARG = _lquery, + RIGHTARG = _ltree, + PROCEDURE = _lt_q_rregex, + COMMUTATOR = '^?', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^@ ( + LEFTARG = _ltree, + RIGHTARG = ltxtquery, + PROCEDURE = _ltxtq_exec, + COMMUTATOR = '^@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +CREATE OPERATOR ^@ ( + LEFTARG = ltxtquery, + RIGHTARG = _ltree, + PROCEDURE = _ltxtq_rexec, + COMMUTATOR = '^@', + RESTRICT = contsel, + JOIN = contjoinsel +); + +--extractors +CREATE FUNCTION _ltree_extract_isparent(_ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR ?@> ( + LEFTARG = _ltree, + RIGHTARG = ltree, + PROCEDURE = _ltree_extract_isparent +); + +CREATE FUNCTION _ltree_extract_risparent(_ltree,ltree) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR ?<@ ( + LEFTARG = _ltree, + RIGHTARG = ltree, + PROCEDURE = _ltree_extract_risparent +); + +CREATE FUNCTION _ltq_extract_regex(_ltree,lquery) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR ?~ ( + LEFTARG = _ltree, + RIGHTARG = lquery, + PROCEDURE = _ltq_extract_regex +); + +CREATE FUNCTION _ltxtq_extract_exec(_ltree,ltxtquery) +RETURNS ltree +AS 'MODULE_PATHNAME' +LANGUAGE C STRICT IMMUTABLE PARALLEL SAFE; + +CREATE OPERATOR ?@ ( + LEFTARG = _ltree, + RIGHTARG = ltxtquery, + PROCEDURE = _ltxtq_extract_exec +); + +--GiST support for ltree[] +CREATE FUNCTION _ltree_consistent(internal,_ltree,int2,oid,internal) +RETURNS bool +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION _ltree_compress(internal) +RETURNS internal +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION _ltree_penalty(internal,internal,internal) +RETURNS internal +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION _ltree_picksplit(internal, internal) +RETURNS internal +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION _ltree_union(internal, internal) +RETURNS ltree_gist +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE FUNCTION _ltree_same(ltree_gist, ltree_gist, internal) +RETURNS internal +AS 'MODULE_PATHNAME' +LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE; + +CREATE OPERATOR CLASS gist__ltree_ops + DEFAULT FOR TYPE _ltree USING gist AS + OPERATOR 10 <@ (_ltree, ltree), + OPERATOR 11 @> (ltree, _ltree), + OPERATOR 12 ~ (_ltree, lquery), + OPERATOR 13 ~ (lquery, _ltree), + OPERATOR 14 @ (_ltree, ltxtquery), + OPERATOR 15 @ (ltxtquery, _ltree), + OPERATOR 16 ? (_ltree, _lquery), + OPERATOR 17 ? (_lquery, _ltree), + FUNCTION 1 _ltree_consistent (internal, _ltree, int2, oid, internal), + FUNCTION 2 _ltree_union (internal, internal), + FUNCTION 3 _ltree_compress (internal), + FUNCTION 4 ltree_decompress (internal), + FUNCTION 5 _ltree_penalty (internal, internal, internal), + FUNCTION 6 _ltree_picksplit (internal, internal), + FUNCTION 7 _ltree_same (ltree_gist, ltree_gist, internal), + STORAGE ltree_gist; diff --git a/contrib/ltree/ltree.control b/contrib/ltree/ltree.control new file mode 100644 index 0000000..b408d64 --- /dev/null +++ b/contrib/ltree/ltree.control @@ -0,0 +1,6 @@ +# ltree extension +comment = 'data type for hierarchical tree-like structures' +default_version = '1.2' +module_pathname = '$libdir/ltree' +relocatable = true +trusted = true diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h new file mode 100644 index 0000000..83fc705 --- /dev/null +++ b/contrib/ltree/ltree.h @@ -0,0 +1,303 @@ +/* contrib/ltree/ltree.h */ + +#ifndef __LTREE_H__ +#define __LTREE_H__ + +#include "fmgr.h" +#include "tsearch/ts_locale.h" +#include "utils/memutils.h" + + +/* ltree */ + +/* + * We want the maximum length of a label to be encoding-independent, so + * set it somewhat arbitrarily at 255 characters (not bytes), while using + * uint16 fields to hold the byte length. + */ +#define LTREE_LABEL_MAX_CHARS 255 + +typedef struct +{ + uint16 len; /* label string length in bytes */ + char name[FLEXIBLE_ARRAY_MEMBER]; +} ltree_level; + +#define LEVEL_HDRSIZE (offsetof(ltree_level,name)) +#define LEVEL_NEXT(x) ( (ltree_level*)( ((char*)(x)) + MAXALIGN(((ltree_level*)(x))->len + LEVEL_HDRSIZE) ) ) + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint16 numlevel; /* number of labels */ + /* Array of maxalign'd ltree_level structs follows: */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} ltree; + +#define LTREE_HDRSIZE MAXALIGN( offsetof(ltree, data) ) +#define LTREE_FIRST(x) ( (ltree_level*)( ((char*)(x))+LTREE_HDRSIZE ) ) +#define LTREE_MAX_LEVELS PG_UINT16_MAX /* ltree.numlevel is uint16 */ + + +/* lquery */ + +/* lquery_variant: one branch of some OR'ed alternatives */ +typedef struct +{ + int32 val; /* CRC of label string */ + uint16 len; /* label string length in bytes */ + uint8 flag; /* see LVAR_xxx flags below */ + char name[FLEXIBLE_ARRAY_MEMBER]; +} lquery_variant; + +/* + * Note: these macros contain too many MAXALIGN calls and so will sometimes + * overestimate the space needed for an lquery_variant. However, we can't + * change it without breaking on-disk compatibility for lquery. + */ +#define LVAR_HDRSIZE MAXALIGN(offsetof(lquery_variant, name)) +#define LVAR_NEXT(x) ( (lquery_variant*)( ((char*)(x)) + MAXALIGN(((lquery_variant*)(x))->len) + LVAR_HDRSIZE ) ) + +#define LVAR_ANYEND 0x01 /* '*' flag: prefix match */ +#define LVAR_INCASE 0x02 /* '@' flag: case-insensitive match */ +#define LVAR_SUBLEXEME 0x04 /* '%' flag: word-wise match */ + +/* + * In an lquery_level, "flag" contains the union of the variants' flags + * along with possible LQL_xxx flags; so those bit sets can't overlap. + * + * "low" and "high" are nominally the minimum and maximum number of matches. + * However, for backwards compatibility with pre-v13 on-disk lqueries, + * non-'*' levels (those with numvar > 0) only have valid low/high if the + * LQL_COUNT flag is set; otherwise those fields are zero, but the behavior + * is as if they were both 1. + */ +typedef struct +{ + uint16 totallen; /* total length of this level, in bytes */ + uint16 flag; /* see LQL_xxx and LVAR_xxx flags */ + uint16 numvar; /* number of variants; 0 means '*' */ + uint16 low; /* minimum repeat count */ + uint16 high; /* maximum repeat count */ + /* Array of maxalign'd lquery_variant structs follows: */ + char variants[FLEXIBLE_ARRAY_MEMBER]; +} lquery_level; + +#define LQL_HDRSIZE MAXALIGN( offsetof(lquery_level,variants) ) +#define LQL_NEXT(x) ( (lquery_level*)( ((char*)(x)) + MAXALIGN(((lquery_level*)(x))->totallen) ) ) +#define LQL_FIRST(x) ( (lquery_variant*)( ((char*)(x))+LQL_HDRSIZE ) ) + +#define LQL_NOT 0x10 /* level has '!' (NOT) prefix */ +#define LQL_COUNT 0x20 /* level is non-'*' and has repeat counts */ + +#ifdef LOWER_NODE +#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME ) ) == 0 ) +#else +#define FLG_CANLOOKSIGN(x) ( ( (x) & ( LQL_NOT | LVAR_ANYEND | LVAR_SUBLEXEME | LVAR_INCASE ) ) == 0 ) +#endif +#define LQL_CANLOOKSIGN(x) FLG_CANLOOKSIGN( ((lquery_level*)(x))->flag ) + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint16 numlevel; /* number of lquery_levels */ + uint16 firstgood; /* number of leading simple-match levels */ + uint16 flag; /* see LQUERY_xxx flags below */ + /* Array of maxalign'd lquery_level structs follows: */ + char data[FLEXIBLE_ARRAY_MEMBER]; +} lquery; + +#define LQUERY_HDRSIZE MAXALIGN( offsetof(lquery, data) ) +#define LQUERY_FIRST(x) ( (lquery_level*)( ((char*)(x))+LQUERY_HDRSIZE ) ) +#define LQUERY_MAX_LEVELS PG_UINT16_MAX /* lquery.numlevel is uint16 */ + +#define LQUERY_HASNOT 0x01 + +#define ISALNUM(x) ( t_isalpha(x) || t_isdigit(x) || ( pg_mblen(x) == 1 && t_iseq((x), '_') ) ) + +/* full text query */ + +/* + * item in polish notation with back link + * to left operand + */ +typedef struct ITEM +{ + int16 type; + int16 left; + int32 val; + uint8 flag; + /* user-friendly value */ + uint8 length; + uint16 distance; +} ITEM; + +/* + *Storage: + * (len)(size)(array of ITEM)(array of operand in user-friendly form) + */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int32 size; + char data[FLEXIBLE_ARRAY_MEMBER]; +} ltxtquery; + +#define HDRSIZEQT MAXALIGN(VARHDRSZ + sizeof(int32)) +#define COMPUTESIZE(size,lenofoperand) ( HDRSIZEQT + (size) * sizeof(ITEM) + (lenofoperand) ) +#define LTXTQUERY_TOO_BIG(size,lenofoperand) \ + ((size) > (MaxAllocSize - HDRSIZEQT - (lenofoperand)) / sizeof(ITEM)) +#define GETQUERY(x) (ITEM*)( (char*)(x)+HDRSIZEQT ) +#define GETOPERAND(x) ( (char*)GETQUERY(x) + ((ltxtquery*)x)->size * sizeof(ITEM) ) + +#define ISOPERATOR(x) ( (x)=='!' || (x)=='&' || (x)=='|' || (x)=='(' || (x)==')' ) + +#define END 0 +#define ERR 1 +#define VAL 2 +#define OPR 3 +#define OPEN 4 +#define CLOSE 5 +#define VALTRUE 6 /* for stop words */ +#define VALFALSE 7 + + +/* use in array iterator */ +Datum ltree_isparent(PG_FUNCTION_ARGS); +Datum ltree_risparent(PG_FUNCTION_ARGS); +Datum ltq_regex(PG_FUNCTION_ARGS); +Datum ltq_rregex(PG_FUNCTION_ARGS); +Datum lt_q_regex(PG_FUNCTION_ARGS); +Datum lt_q_rregex(PG_FUNCTION_ARGS); +Datum ltxtq_exec(PG_FUNCTION_ARGS); +Datum ltxtq_rexec(PG_FUNCTION_ARGS); +Datum _ltq_regex(PG_FUNCTION_ARGS); +Datum _ltq_rregex(PG_FUNCTION_ARGS); +Datum _lt_q_regex(PG_FUNCTION_ARGS); +Datum _lt_q_rregex(PG_FUNCTION_ARGS); +Datum _ltxtq_exec(PG_FUNCTION_ARGS); +Datum _ltxtq_rexec(PG_FUNCTION_ARGS); +Datum _ltree_isparent(PG_FUNCTION_ARGS); +Datum _ltree_risparent(PG_FUNCTION_ARGS); + +/* Concatenation functions */ +Datum ltree_addltree(PG_FUNCTION_ARGS); +Datum ltree_addtext(PG_FUNCTION_ARGS); +Datum ltree_textadd(PG_FUNCTION_ARGS); + +/* Util function */ +Datum ltree_in(PG_FUNCTION_ARGS); + +bool ltree_execute(ITEM *curitem, void *checkval, + bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)); + +int ltree_compare(const ltree *a, const ltree *b); +bool inner_isparent(const ltree *c, const ltree *p); +bool compare_subnode(ltree_level *t, char *q, int len, + int (*cmpptr) (const char *, const char *, size_t), bool anyend); +ltree *lca_inner(ltree **a, int len); +int ltree_strncasecmp(const char *a, const char *b, size_t s); + +/* fmgr macros for ltree objects */ +#define DatumGetLtreeP(X) ((ltree *) PG_DETOAST_DATUM(X)) +#define DatumGetLtreePCopy(X) ((ltree *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_LTREE_P(n) DatumGetLtreeP(PG_GETARG_DATUM(n)) +#define PG_GETARG_LTREE_P_COPY(n) DatumGetLtreePCopy(PG_GETARG_DATUM(n)) + +#define DatumGetLqueryP(X) ((lquery *) PG_DETOAST_DATUM(X)) +#define DatumGetLqueryPCopy(X) ((lquery *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_LQUERY_P(n) DatumGetLqueryP(PG_GETARG_DATUM(n)) +#define PG_GETARG_LQUERY_P_COPY(n) DatumGetLqueryPCopy(PG_GETARG_DATUM(n)) + +#define DatumGetLtxtqueryP(X) ((ltxtquery *) PG_DETOAST_DATUM(X)) +#define DatumGetLtxtqueryPCopy(X) ((ltxtquery *) PG_DETOAST_DATUM_COPY(X)) +#define PG_GETARG_LTXTQUERY_P(n) DatumGetLtxtqueryP(PG_GETARG_DATUM(n)) +#define PG_GETARG_LTXTQUERY_P_COPY(n) DatumGetLtxtqueryPCopy(PG_GETARG_DATUM(n)) + +/* GiST support for ltree */ + +#define BITBYTE 8 +#define SIGLENBIT(siglen) ((siglen) * BITBYTE) +#define LTREE_SIGLEN_DEFAULT (2 * sizeof(int32)) +#define LTREE_SIGLEN_MAX GISTMaxIndexKeySize +#define LTREE_GET_SIGLEN() (PG_HAS_OPCLASS_OPTIONS() ? \ + ((LtreeGistOptions *) PG_GET_OPCLASS_OPTIONS())->siglen : \ + LTREE_SIGLEN_DEFAULT) + +typedef unsigned char *BITVECP; + +#define LOOPBYTE(siglen) \ + for(i = 0; i < (siglen); i++) + +#define GETBYTE(x,i) ( *( (BITVECP)(x) + (int)( (i) / BITBYTE ) ) ) +#define GETBITBYTE(x,i) ( ((unsigned char)(x)) >> i & 0x01 ) +#define CLRBIT(x,i) GETBYTE(x,i) &= ~( 0x01 << ( (i) % BITBYTE ) ) +#define SETBIT(x,i) GETBYTE(x,i) |= ( 0x01 << ( (i) % BITBYTE ) ) +#define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 ) + +#define HASHVAL(val, siglen) (((unsigned int)(val)) % SIGLENBIT(siglen)) +#define HASH(sign, val, siglen) SETBIT((sign), HASHVAL(val, siglen)) + +/* + * type of index key for ltree. Tree are combined B-Tree and R-Tree + * Storage: + * Leaf pages + * (len)(flag)(ltree) + * Non-Leaf + * (len)(flag)(sign)(left_ltree)(right_ltree) + * ALLTRUE: (len)(flag)(left_ltree)(right_ltree) + * + */ + +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + uint32 flag; + char data[FLEXIBLE_ARRAY_MEMBER]; +} ltree_gist; + +#define LTG_ONENODE 0x01 +#define LTG_ALLTRUE 0x02 +#define LTG_NORIGHT 0x04 + +#define LTG_HDRSIZE MAXALIGN(VARHDRSZ + sizeof(uint32)) +#define LTG_SIGN(x) ( (BITVECP)( ((char*)(x))+LTG_HDRSIZE ) ) +#define LTG_NODE(x) ( (ltree*)( ((char*)(x))+LTG_HDRSIZE ) ) +#define LTG_ISONENODE(x) ( ((ltree_gist*)(x))->flag & LTG_ONENODE ) +#define LTG_ISALLTRUE(x) ( ((ltree_gist*)(x))->flag & LTG_ALLTRUE ) +#define LTG_ISNORIGHT(x) ( ((ltree_gist*)(x))->flag & LTG_NORIGHT ) +#define LTG_LNODE(x, siglen) ( (ltree*)( ( ((char*)(x))+LTG_HDRSIZE ) + ( LTG_ISALLTRUE(x) ? 0 : (siglen) ) ) ) +#define LTG_RENODE(x, siglen) ( (ltree*)( ((char*)LTG_LNODE(x, siglen)) + VARSIZE(LTG_LNODE(x, siglen))) ) +#define LTG_RNODE(x, siglen) ( LTG_ISNORIGHT(x) ? LTG_LNODE(x, siglen) : LTG_RENODE(x, siglen) ) + +#define LTG_GETLNODE(x, siglen) ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_LNODE(x, siglen) ) +#define LTG_GETRNODE(x, siglen) ( LTG_ISONENODE(x) ? LTG_NODE(x) : LTG_RNODE(x, siglen) ) + +extern ltree_gist *ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen, + ltree *left, ltree *right); + +/* GiST support for ltree[] */ + +#define LTREE_ASIGLEN_DEFAULT (7 * sizeof(int32)) +#define LTREE_ASIGLEN_MAX GISTMaxIndexKeySize +#define LTREE_GET_ASIGLEN() (PG_HAS_OPCLASS_OPTIONS() ? \ + ((LtreeGistOptions *) PG_GET_OPCLASS_OPTIONS())->siglen : \ + LTREE_ASIGLEN_DEFAULT) +#define ASIGLENBIT(siglen) ((siglen) * BITBYTE) + +#define ALOOPBYTE(siglen) \ + for (i = 0; i < (siglen); i++) + +#define AHASHVAL(val, siglen) (((unsigned int)(val)) % ASIGLENBIT(siglen)) +#define AHASH(sign, val, siglen) SETBIT((sign), AHASHVAL(val, siglen)) + +/* gist_ltree_ops and gist__ltree_ops opclass options */ +typedef struct +{ + int32 vl_len_; /* varlena header (do not touch directly!) */ + int siglen; /* signature length in bytes */ +} LtreeGistOptions; + +/* type of key is the same to ltree_gist */ + +#endif diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c new file mode 100644 index 0000000..d384e1f --- /dev/null +++ b/contrib/ltree/ltree_gist.c @@ -0,0 +1,731 @@ +/* + * GiST support for ltree + * Teodor Sigaev <teodor@stack.net> + * contrib/ltree/ltree_gist.c + */ +#include "postgres.h" + +#include "access/gist.h" +#include "access/reloptions.h" +#include "access/stratnum.h" +#include "crc32.h" +#include "ltree.h" + +#define NEXTVAL(x) ( (lquery*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) ) +#define ISEQ(a,b) ( (a)->numlevel == (b)->numlevel && ltree_compare(a,b)==0 ) + +PG_FUNCTION_INFO_V1(ltree_gist_in); +PG_FUNCTION_INFO_V1(ltree_gist_out); + +Datum +ltree_gist_in(PG_FUNCTION_ARGS) +{ + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("ltree_gist_in() not implemented"))); + PG_RETURN_DATUM(0); +} + +Datum +ltree_gist_out(PG_FUNCTION_ARGS) +{ + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("ltree_gist_out() not implemented"))); + PG_RETURN_DATUM(0); +} + +ltree_gist * +ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen, + ltree *left, ltree *right) +{ + int32 size = LTG_HDRSIZE + (isalltrue ? 0 : siglen) + + (left ? VARSIZE(left) + (right ? VARSIZE(right) : 0) : 0); + ltree_gist *result = palloc(size); + + SET_VARSIZE(result, size); + + if (siglen) + { + result->flag = 0; + + if (isalltrue) + result->flag |= LTG_ALLTRUE; + else if (sign) + memcpy(LTG_SIGN(result), sign, siglen); + else + memset(LTG_SIGN(result), 0, siglen); + + if (left) + { + memcpy(LTG_LNODE(result, siglen), left, VARSIZE(left)); + + if (!right || left == right || ISEQ(left, right)) + result->flag |= LTG_NORIGHT; + else + memcpy(LTG_RNODE(result, siglen), right, VARSIZE(right)); + } + } + else + { + Assert(left); + result->flag = LTG_ONENODE; + memcpy(LTG_NODE(result), left, VARSIZE(left)); + } + + return result; +} + +PG_FUNCTION_INFO_V1(ltree_compress); +PG_FUNCTION_INFO_V1(ltree_decompress); +PG_FUNCTION_INFO_V1(ltree_same); +PG_FUNCTION_INFO_V1(ltree_union); +PG_FUNCTION_INFO_V1(ltree_penalty); +PG_FUNCTION_INFO_V1(ltree_picksplit); +PG_FUNCTION_INFO_V1(ltree_consistent); +PG_FUNCTION_INFO_V1(ltree_gist_options); + +#define GETENTRY(vec,pos) ((ltree_gist *) DatumGetPointer((vec)->vector[(pos)].key)) + +Datum +ltree_compress(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + GISTENTRY *retval = entry; + + if (entry->leafkey) + { /* ltree */ + ltree *val = DatumGetLtreeP(entry->key); + ltree_gist *key = ltree_gist_alloc(false, NULL, 0, val, 0); + + retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); + gistentryinit(*retval, PointerGetDatum(key), + entry->rel, entry->page, + entry->offset, false); + } + PG_RETURN_POINTER(retval); +} + +Datum +ltree_decompress(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + ltree_gist *key = (ltree_gist *) PG_DETOAST_DATUM(entry->key); + + if (PointerGetDatum(key) != entry->key) + { + GISTENTRY *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); + + gistentryinit(*retval, PointerGetDatum(key), + entry->rel, entry->page, + entry->offset, false); + PG_RETURN_POINTER(retval); + } + PG_RETURN_POINTER(entry); +} + +Datum +ltree_same(PG_FUNCTION_ARGS) +{ + ltree_gist *a = (ltree_gist *) PG_GETARG_POINTER(0); + ltree_gist *b = (ltree_gist *) PG_GETARG_POINTER(1); + bool *result = (bool *) PG_GETARG_POINTER(2); + int siglen = LTREE_GET_SIGLEN(); + + *result = false; + if (LTG_ISONENODE(a) != LTG_ISONENODE(b)) + PG_RETURN_POINTER(result); + + if (LTG_ISONENODE(a)) + *result = (ISEQ(LTG_NODE(a), LTG_NODE(b))) ? true : false; + else + { + int32 i; + BITVECP sa = LTG_SIGN(a), + sb = LTG_SIGN(b); + + if (LTG_ISALLTRUE(a) != LTG_ISALLTRUE(b)) + PG_RETURN_POINTER(result); + + if (!ISEQ(LTG_LNODE(a, siglen), LTG_LNODE(b, siglen))) + PG_RETURN_POINTER(result); + if (!ISEQ(LTG_RNODE(a, siglen), LTG_RNODE(b, siglen))) + PG_RETURN_POINTER(result); + + *result = true; + if (!LTG_ISALLTRUE(a)) + { + LOOPBYTE(siglen) + { + if (sa[i] != sb[i]) + { + *result = false; + break; + } + } + } + } + + PG_RETURN_POINTER(result); +} + +static void +hashing(BITVECP sign, ltree *t, int siglen) +{ + int tlen = t->numlevel; + ltree_level *cur = LTREE_FIRST(t); + int hash; + + while (tlen > 0) + { + hash = ltree_crc32_sz(cur->name, cur->len); + HASH(sign, hash, siglen); + cur = LEVEL_NEXT(cur); + tlen--; + } +} + +Datum +ltree_union(PG_FUNCTION_ARGS) +{ + GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0); + int *size = (int *) PG_GETARG_POINTER(1); + int siglen = LTREE_GET_SIGLEN(); + BITVECP base = palloc0(siglen); + int32 i, + j; + ltree_gist *result, + *cur; + ltree *left = NULL, + *right = NULL, + *curtree; + bool isalltrue = false; + + for (j = 0; j < entryvec->n; j++) + { + cur = GETENTRY(entryvec, j); + if (LTG_ISONENODE(cur)) + { + curtree = LTG_NODE(cur); + hashing(base, curtree, siglen); + if (!left || ltree_compare(left, curtree) > 0) + left = curtree; + if (!right || ltree_compare(right, curtree) < 0) + right = curtree; + } + else + { + if (isalltrue || LTG_ISALLTRUE(cur)) + isalltrue = true; + else + { + BITVECP sc = LTG_SIGN(cur); + + LOOPBYTE(siglen) + ((unsigned char *) base)[i] |= sc[i]; + } + + curtree = LTG_LNODE(cur, siglen); + if (!left || ltree_compare(left, curtree) > 0) + left = curtree; + curtree = LTG_RNODE(cur, siglen); + if (!right || ltree_compare(right, curtree) < 0) + right = curtree; + } + } + + if (isalltrue == false) + { + isalltrue = true; + LOOPBYTE(siglen) + { + if (((unsigned char *) base)[i] != 0xff) + { + isalltrue = false; + break; + } + } + } + + result = ltree_gist_alloc(isalltrue, base, siglen, left, right); + + *size = VARSIZE(result); + + PG_RETURN_POINTER(result); +} + +Datum +ltree_penalty(PG_FUNCTION_ARGS) +{ + ltree_gist *origval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key); + ltree_gist *newval = (ltree_gist *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(1))->key); + float *penalty = (float *) PG_GETARG_POINTER(2); + int siglen = LTREE_GET_SIGLEN(); + int32 cmpr, + cmpl; + + cmpl = ltree_compare(LTG_GETLNODE(origval, siglen), LTG_GETLNODE(newval, siglen)); + cmpr = ltree_compare(LTG_GETRNODE(newval, siglen), LTG_GETRNODE(origval, siglen)); + + *penalty = Max(cmpl, 0) + Max(cmpr, 0); + + PG_RETURN_POINTER(penalty); +} + +/* used for sorting */ +typedef struct rix +{ + int index; + ltree *r; +} RIX; + +static int +treekey_cmp(const void *a, const void *b) +{ + return ltree_compare(((const RIX *) a)->r, + ((const RIX *) b)->r); +} + + +Datum +ltree_picksplit(PG_FUNCTION_ARGS) +{ + GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0); + GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1); + int siglen = LTREE_GET_SIGLEN(); + OffsetNumber j; + int32 i; + RIX *array; + OffsetNumber maxoff; + int nbytes; + ltree *lu_l, + *lu_r, + *ru_l, + *ru_r; + ltree_gist *lu, + *ru; + BITVECP ls = palloc0(siglen), + rs = palloc0(siglen); + bool lisat = false, + risat = false; + + maxoff = entryvec->n - 1; + nbytes = (maxoff + 2) * sizeof(OffsetNumber); + v->spl_left = (OffsetNumber *) palloc(nbytes); + v->spl_right = (OffsetNumber *) palloc(nbytes); + v->spl_nleft = 0; + v->spl_nright = 0; + array = (RIX *) palloc(sizeof(RIX) * (maxoff + 1)); + + /* copy the data into RIXes, and sort the RIXes */ + for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) + { + array[j].index = j; + lu = GETENTRY(entryvec, j); /* use as tmp val */ + array[j].r = LTG_GETLNODE(lu, siglen); + } + + qsort((void *) &array[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1, + sizeof(RIX), treekey_cmp); + + lu_l = lu_r = ru_l = ru_r = NULL; + for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) + { + lu = GETENTRY(entryvec, array[j].index); /* use as tmp val */ + if (j <= (maxoff - FirstOffsetNumber + 1) / 2) + { + v->spl_left[v->spl_nleft] = array[j].index; + v->spl_nleft++; + if (lu_r == NULL || ltree_compare(LTG_GETRNODE(lu, siglen), lu_r) > 0) + lu_r = LTG_GETRNODE(lu, siglen); + if (LTG_ISONENODE(lu)) + hashing(ls, LTG_NODE(lu), siglen); + else + { + if (lisat || LTG_ISALLTRUE(lu)) + lisat = true; + else + { + BITVECP sc = LTG_SIGN(lu); + + LOOPBYTE(siglen) + ((unsigned char *) ls)[i] |= sc[i]; + } + } + } + else + { + v->spl_right[v->spl_nright] = array[j].index; + v->spl_nright++; + if (ru_r == NULL || ltree_compare(LTG_GETRNODE(lu, siglen), ru_r) > 0) + ru_r = LTG_GETRNODE(lu, siglen); + if (LTG_ISONENODE(lu)) + hashing(rs, LTG_NODE(lu), siglen); + else + { + if (risat || LTG_ISALLTRUE(lu)) + risat = true; + else + { + BITVECP sc = LTG_SIGN(lu); + + LOOPBYTE(siglen) + ((unsigned char *) rs)[i] |= sc[i]; + } + } + } + } + + if (lisat == false) + { + lisat = true; + LOOPBYTE(siglen) + { + if (((unsigned char *) ls)[i] != 0xff) + { + lisat = false; + break; + } + } + } + + if (risat == false) + { + risat = true; + LOOPBYTE(siglen) + { + if (((unsigned char *) rs)[i] != 0xff) + { + risat = false; + break; + } + } + } + + lu_l = LTG_GETLNODE(GETENTRY(entryvec, array[FirstOffsetNumber].index), siglen); + lu = ltree_gist_alloc(lisat, ls, siglen, lu_l, lu_r); + + ru_l = LTG_GETLNODE(GETENTRY(entryvec, array[1 + ((maxoff - FirstOffsetNumber + 1) / 2)].index), siglen); + ru = ltree_gist_alloc(risat, rs, siglen, ru_l, ru_r); + + pfree(ls); + pfree(rs); + + v->spl_ldatum = PointerGetDatum(lu); + v->spl_rdatum = PointerGetDatum(ru); + + PG_RETURN_POINTER(v); +} + +static bool +gist_isparent(ltree_gist *key, ltree *query, int siglen) +{ + int32 numlevel = query->numlevel; + int i; + + for (i = query->numlevel; i >= 0; i--) + { + query->numlevel = i; + if (ltree_compare(query, LTG_GETLNODE(key, siglen)) >= 0 && + ltree_compare(query, LTG_GETRNODE(key, siglen)) <= 0) + { + query->numlevel = numlevel; + return true; + } + } + + query->numlevel = numlevel; + return false; +} + +static ltree * +copy_ltree(ltree *src) +{ + ltree *dst = (ltree *) palloc0(VARSIZE(src)); + + memcpy(dst, src, VARSIZE(src)); + return dst; +} + +static bool +gist_ischild(ltree_gist *key, ltree *query, int siglen) +{ + ltree *left = copy_ltree(LTG_GETLNODE(key, siglen)); + ltree *right = copy_ltree(LTG_GETRNODE(key, siglen)); + bool res = true; + + if (left->numlevel > query->numlevel) + left->numlevel = query->numlevel; + + if (ltree_compare(query, left) < 0) + res = false; + + if (right->numlevel > query->numlevel) + right->numlevel = query->numlevel; + + if (res && ltree_compare(query, right) > 0) + res = false; + + pfree(left); + pfree(right); + + return res; +} + +static bool +gist_qe(ltree_gist *key, lquery *query, int siglen) +{ + lquery_level *curq = LQUERY_FIRST(query); + BITVECP sign = LTG_SIGN(key); + int qlen = query->numlevel; + + if (LTG_ISALLTRUE(key)) + return true; + + while (qlen > 0) + { + if (curq->numvar && LQL_CANLOOKSIGN(curq)) + { + bool isexist = false; + int vlen = curq->numvar; + lquery_variant *curv = LQL_FIRST(curq); + + while (vlen > 0) + { + if (GETBIT(sign, HASHVAL(curv->val, siglen))) + { + isexist = true; + break; + } + curv = LVAR_NEXT(curv); + vlen--; + } + if (!isexist) + return false; + } + + curq = LQL_NEXT(curq); + qlen--; + } + + return true; +} + +static int +gist_tqcmp(ltree *t, lquery *q) +{ + ltree_level *al = LTREE_FIRST(t); + lquery_level *ql = LQUERY_FIRST(q); + lquery_variant *bl; + int an = t->numlevel; + int bn = q->firstgood; + int res = 0; + + while (an > 0 && bn > 0) + { + bl = LQL_FIRST(ql); + if ((res = memcmp(al->name, bl->name, Min(al->len, bl->len))) == 0) + { + if (al->len != bl->len) + return al->len - bl->len; + } + else + return res; + an--; + bn--; + al = LEVEL_NEXT(al); + ql = LQL_NEXT(ql); + } + + return Min(t->numlevel, q->firstgood) - q->firstgood; +} + +static bool +gist_between(ltree_gist *key, lquery *query, int siglen) +{ + if (query->firstgood == 0) + return true; + + if (gist_tqcmp(LTG_GETLNODE(key, siglen), query) > 0) + return false; + + if (gist_tqcmp(LTG_GETRNODE(key, siglen), query) < 0) + return false; + + return true; +} + +typedef struct LtreeSignature +{ + BITVECP sign; + int siglen; +} LtreeSignature; + +static bool +checkcondition_bit(void *cxt, ITEM *val) +{ + LtreeSignature *sig = cxt; + + return (FLG_CANLOOKSIGN(val->flag)) ? GETBIT(sig->sign, HASHVAL(val->val, sig->siglen)) : true; +} + +static bool +gist_qtxt(ltree_gist *key, ltxtquery *query, int siglen) +{ + LtreeSignature sig; + + if (LTG_ISALLTRUE(key)) + return true; + + sig.sign = LTG_SIGN(key); + sig.siglen = siglen; + + return ltree_execute(GETQUERY(query), + &sig, false, + checkcondition_bit); +} + +static bool +arrq_cons(ltree_gist *key, ArrayType *_query, int siglen) +{ + lquery *query = (lquery *) ARR_DATA_PTR(_query); + int num = ArrayGetNItems(ARR_NDIM(_query), ARR_DIMS(_query)); + + if (ARR_NDIM(_query) > 1) + ereport(ERROR, + (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), + errmsg("array must be one-dimensional"))); + if (array_contains_nulls(_query)) + ereport(ERROR, + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), + errmsg("array must not contain nulls"))); + + while (num > 0) + { + if (gist_qe(key, query, siglen) && gist_between(key, query, siglen)) + return true; + num--; + query = NEXTVAL(query); + } + return false; +} + +Datum +ltree_consistent(PG_FUNCTION_ARGS) +{ + GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); + StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); + int siglen = LTREE_GET_SIGLEN(); + ltree_gist *key = (ltree_gist *) DatumGetPointer(entry->key); + void *query = NULL; + bool res = false; + + /* All cases served by this function are exact */ + *recheck = false; + + switch (strategy) + { + case BTLessStrategyNumber: + query = PG_GETARG_LTREE_P(1); + res = (GIST_LEAF(entry)) ? + (ltree_compare((ltree *) query, LTG_NODE(key)) > 0) + : + (ltree_compare((ltree *) query, LTG_GETLNODE(key, siglen)) >= 0); + break; + case BTLessEqualStrategyNumber: + query = PG_GETARG_LTREE_P(1); + res = (ltree_compare((ltree *) query, LTG_GETLNODE(key, siglen)) >= 0); + break; + case BTEqualStrategyNumber: + query = PG_GETARG_LTREE_P(1); + if (GIST_LEAF(entry)) + res = (ltree_compare((ltree *) query, LTG_NODE(key)) == 0); + else + res = (ltree_compare((ltree *) query, LTG_GETLNODE(key, siglen)) >= 0 + && + ltree_compare((ltree *) query, LTG_GETRNODE(key, siglen)) <= 0); + break; + case BTGreaterEqualStrategyNumber: + query = PG_GETARG_LTREE_P(1); + res = (ltree_compare((ltree *) query, LTG_GETRNODE(key, siglen)) <= 0); + break; + case BTGreaterStrategyNumber: + query = PG_GETARG_LTREE_P(1); + res = (GIST_LEAF(entry)) ? + (ltree_compare((ltree *) query, LTG_GETRNODE(key, siglen)) < 0) + : + (ltree_compare((ltree *) query, LTG_GETRNODE(key, siglen)) <= 0); + break; + case 10: + query = PG_GETARG_LTREE_P_COPY(1); + res = (GIST_LEAF(entry)) ? + inner_isparent((ltree *) query, LTG_NODE(key)) + : + gist_isparent(key, (ltree *) query, siglen); + break; + case 11: + query = PG_GETARG_LTREE_P(1); + res = (GIST_LEAF(entry)) ? + inner_isparent(LTG_NODE(key), (ltree *) query) + : + gist_ischild(key, (ltree *) query, siglen); + break; + case 12: + case 13: + query = PG_GETARG_LQUERY_P(1); + if (GIST_LEAF(entry)) + res = DatumGetBool(DirectFunctionCall2(ltq_regex, + PointerGetDatum(LTG_NODE(key)), + PointerGetDatum((lquery *) query) + )); + else + res = (gist_qe(key, (lquery *) query, siglen) && + gist_between(key, (lquery *) query, siglen)); + break; + case 14: + case 15: + query = PG_GETARG_LTXTQUERY_P(1); + if (GIST_LEAF(entry)) + res = DatumGetBool(DirectFunctionCall2(ltxtq_exec, + PointerGetDatum(LTG_NODE(key)), + PointerGetDatum((ltxtquery *) query) + )); + else + res = gist_qtxt(key, (ltxtquery *) query, siglen); + break; + case 16: + case 17: + query = PG_GETARG_ARRAYTYPE_P(1); + if (GIST_LEAF(entry)) + res = DatumGetBool(DirectFunctionCall2(lt_q_regex, + PointerGetDatum(LTG_NODE(key)), + PointerGetDatum((ArrayType *) query) + )); + else + res = arrq_cons(key, (ArrayType *) query, siglen); + break; + default: + /* internal error */ + elog(ERROR, "unrecognized StrategyNumber: %d", strategy); + } + + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(res); +} + +Datum +ltree_gist_options(PG_FUNCTION_ARGS) +{ + local_relopts *relopts = (local_relopts *) PG_GETARG_POINTER(0); + + init_local_reloptions(relopts, sizeof(LtreeGistOptions)); + add_local_int_reloption(relopts, "siglen", + "signature length in bytes", + LTREE_SIGLEN_DEFAULT, 1, LTREE_SIGLEN_MAX, + offsetof(LtreeGistOptions, siglen)); + + PG_RETURN_VOID(); +} diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c new file mode 100644 index 0000000..15115cb --- /dev/null +++ b/contrib/ltree/ltree_io.c @@ -0,0 +1,797 @@ +/* + * in/out function for ltree and lquery + * Teodor Sigaev <teodor@stack.net> + * contrib/ltree/ltree_io.c + */ +#include "postgres.h" + +#include <ctype.h> + +#include "crc32.h" +#include "libpq/pqformat.h" +#include "ltree.h" +#include "utils/memutils.h" + + +typedef struct +{ + const char *start; + int len; /* length in bytes */ + int flag; + int wlen; /* length in characters */ +} nodeitem; + +#define LTPRS_WAITNAME 0 +#define LTPRS_WAITDELIM 1 + +static void finish_nodeitem(nodeitem *lptr, const char *ptr, + bool is_lquery, int pos); + + +/* + * expects a null terminated string + * returns an ltree + */ +static ltree * +parse_ltree(const char *buf) +{ + const char *ptr; + nodeitem *list, + *lptr; + int num = 0, + totallen = 0; + int state = LTPRS_WAITNAME; + ltree *result; + ltree_level *curlevel; + int charlen; + int pos = 1; /* character position for error messages */ + +#define UNCHAR ereport(ERROR, \ + errcode(ERRCODE_SYNTAX_ERROR), \ + errmsg("ltree syntax error at character %d", \ + pos)) + + ptr = buf; + while (*ptr) + { + charlen = pg_mblen(ptr); + if (t_iseq(ptr, '.')) + num++; + ptr += charlen; + } + + if (num + 1 > LTREE_MAX_LEVELS) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("number of ltree labels (%d) exceeds the maximum allowed (%d)", + num + 1, LTREE_MAX_LEVELS))); + list = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (num + 1)); + ptr = buf; + while (*ptr) + { + charlen = pg_mblen(ptr); + + switch (state) + { + case LTPRS_WAITNAME: + if (ISALNUM(ptr)) + { + lptr->start = ptr; + lptr->wlen = 0; + state = LTPRS_WAITDELIM; + } + else + UNCHAR; + break; + case LTPRS_WAITDELIM: + if (t_iseq(ptr, '.')) + { + finish_nodeitem(lptr, ptr, false, pos); + totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); + lptr++; + state = LTPRS_WAITNAME; + } + else if (!ISALNUM(ptr)) + UNCHAR; + break; + default: + elog(ERROR, "internal error in ltree parser"); + } + + ptr += charlen; + lptr->wlen++; + pos++; + } + + if (state == LTPRS_WAITDELIM) + { + finish_nodeitem(lptr, ptr, false, pos); + totallen += MAXALIGN(lptr->len + LEVEL_HDRSIZE); + lptr++; + } + else if (!(state == LTPRS_WAITNAME && lptr == list)) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("ltree syntax error"), + errdetail("Unexpected end of input."))); + + result = (ltree *) palloc0(LTREE_HDRSIZE + totallen); + SET_VARSIZE(result, LTREE_HDRSIZE + totallen); + result->numlevel = lptr - list; + curlevel = LTREE_FIRST(result); + lptr = list; + while (lptr - list < result->numlevel) + { + curlevel->len = (uint16) lptr->len; + memcpy(curlevel->name, lptr->start, lptr->len); + curlevel = LEVEL_NEXT(curlevel); + lptr++; + } + + pfree(list); + return result; + +#undef UNCHAR +} + +/* + * expects an ltree + * returns a null terminated string + */ +static char * +deparse_ltree(const ltree *in) +{ + char *buf, + *ptr; + int i; + ltree_level *curlevel; + + ptr = buf = (char *) palloc(VARSIZE(in)); + curlevel = LTREE_FIRST(in); + for (i = 0; i < in->numlevel; i++) + { + if (i != 0) + { + *ptr = '.'; + ptr++; + } + memcpy(ptr, curlevel->name, curlevel->len); + ptr += curlevel->len; + curlevel = LEVEL_NEXT(curlevel); + } + + *ptr = '\0'; + return buf; +} + +/* + * Basic ltree I/O functions + */ +PG_FUNCTION_INFO_V1(ltree_in); +Datum +ltree_in(PG_FUNCTION_ARGS) +{ + char *buf = (char *) PG_GETARG_POINTER(0); + + PG_RETURN_POINTER(parse_ltree(buf)); +} + +PG_FUNCTION_INFO_V1(ltree_out); +Datum +ltree_out(PG_FUNCTION_ARGS) +{ + ltree *in = PG_GETARG_LTREE_P(0); + + PG_RETURN_POINTER(deparse_ltree(in)); +} + +/* + * ltree type send function + * + * The type is sent as text in binary mode, so this is almost the same + * as the output function, but it's prefixed with a version number so we + * can change the binary format sent in future if necessary. For now, + * only version 1 is supported. + */ +PG_FUNCTION_INFO_V1(ltree_send); +Datum +ltree_send(PG_FUNCTION_ARGS) +{ + ltree *in = PG_GETARG_LTREE_P(0); + StringInfoData buf; + int version = 1; + char *res = deparse_ltree(in); + + pq_begintypsend(&buf); + pq_sendint8(&buf, version); + pq_sendtext(&buf, res, strlen(res)); + pfree(res); + + PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); +} + +/* + * ltree type recv function + * + * The type is sent as text in binary mode, so this is almost the same + * as the input function, but it's prefixed with a version number so we + * can change the binary format sent in future if necessary. For now, + * only version 1 is supported. + */ +PG_FUNCTION_INFO_V1(ltree_recv); +Datum +ltree_recv(PG_FUNCTION_ARGS) +{ + StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); + int version = pq_getmsgint(buf, 1); + char *str; + int nbytes; + ltree *res; + + if (version != 1) + elog(ERROR, "unsupported ltree version number %d", version); + + str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); + res = parse_ltree(str); + pfree(str); + + PG_RETURN_POINTER(res); +} + + +#define LQPRS_WAITLEVEL 0 +#define LQPRS_WAITDELIM 1 +#define LQPRS_WAITOPEN 2 +#define LQPRS_WAITFNUM 3 +#define LQPRS_WAITSNUM 4 +#define LQPRS_WAITND 5 +#define LQPRS_WAITCLOSE 6 +#define LQPRS_WAITEND 7 +#define LQPRS_WAITVAR 8 + + +#define GETVAR(x) ( *((nodeitem**)LQL_FIRST(x)) ) +#define ITEMSIZE MAXALIGN(LQL_HDRSIZE+sizeof(nodeitem*)) +#define NEXTLEV(x) ( (lquery_level*)( ((char*)(x)) + ITEMSIZE) ) + +/* + * expects a null terminated string + * returns an lquery + */ +static lquery * +parse_lquery(const char *buf) +{ + const char *ptr; + int num = 0, + totallen = 0, + numOR = 0; + int state = LQPRS_WAITLEVEL; + lquery *result; + nodeitem *lptr = NULL; + lquery_level *cur, + *curqlevel, + *tmpql; + lquery_variant *lrptr = NULL; + bool hasnot = false; + bool wasbad = false; + int charlen; + int pos = 1; /* character position for error messages */ + +#define UNCHAR ereport(ERROR, \ + errcode(ERRCODE_SYNTAX_ERROR), \ + errmsg("lquery syntax error at character %d", \ + pos)) + + ptr = buf; + while (*ptr) + { + charlen = pg_mblen(ptr); + + if (t_iseq(ptr, '.')) + num++; + else if (t_iseq(ptr, '|')) + numOR++; + + ptr += charlen; + } + + num++; + if (num > LQUERY_MAX_LEVELS) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("number of lquery items (%d) exceeds the maximum allowed (%d)", + num, LQUERY_MAX_LEVELS))); + curqlevel = tmpql = (lquery_level *) palloc0(ITEMSIZE * num); + ptr = buf; + while (*ptr) + { + charlen = pg_mblen(ptr); + + switch (state) + { + case LQPRS_WAITLEVEL: + if (ISALNUM(ptr)) + { + GETVAR(curqlevel) = lptr = (nodeitem *) palloc0(sizeof(nodeitem) * (numOR + 1)); + lptr->start = ptr; + state = LQPRS_WAITDELIM; + curqlevel->numvar = 1; + } + else if (t_iseq(ptr, '!')) + { + GETVAR(curqlevel) = lptr = (nodeitem *) palloc0(sizeof(nodeitem) * (numOR + 1)); + lptr->start = ptr + 1; + lptr->wlen = -1; /* compensate for counting ! below */ + state = LQPRS_WAITDELIM; + curqlevel->numvar = 1; + curqlevel->flag |= LQL_NOT; + hasnot = true; + } + else if (t_iseq(ptr, '*')) + state = LQPRS_WAITOPEN; + else + UNCHAR; + break; + case LQPRS_WAITVAR: + if (ISALNUM(ptr)) + { + lptr++; + lptr->start = ptr; + state = LQPRS_WAITDELIM; + curqlevel->numvar++; + } + else + UNCHAR; + break; + case LQPRS_WAITDELIM: + if (t_iseq(ptr, '@')) + { + lptr->flag |= LVAR_INCASE; + curqlevel->flag |= LVAR_INCASE; + } + else if (t_iseq(ptr, '*')) + { + lptr->flag |= LVAR_ANYEND; + curqlevel->flag |= LVAR_ANYEND; + } + else if (t_iseq(ptr, '%')) + { + lptr->flag |= LVAR_SUBLEXEME; + curqlevel->flag |= LVAR_SUBLEXEME; + } + else if (t_iseq(ptr, '|')) + { + finish_nodeitem(lptr, ptr, true, pos); + state = LQPRS_WAITVAR; + } + else if (t_iseq(ptr, '{')) + { + finish_nodeitem(lptr, ptr, true, pos); + curqlevel->flag |= LQL_COUNT; + state = LQPRS_WAITFNUM; + } + else if (t_iseq(ptr, '.')) + { + finish_nodeitem(lptr, ptr, true, pos); + state = LQPRS_WAITLEVEL; + curqlevel = NEXTLEV(curqlevel); + } + else if (ISALNUM(ptr)) + { + /* disallow more chars after a flag */ + if (lptr->flag) + UNCHAR; + } + else + UNCHAR; + break; + case LQPRS_WAITOPEN: + if (t_iseq(ptr, '{')) + state = LQPRS_WAITFNUM; + else if (t_iseq(ptr, '.')) + { + /* We only get here for '*', so these are correct defaults */ + curqlevel->low = 0; + curqlevel->high = LTREE_MAX_LEVELS; + curqlevel = NEXTLEV(curqlevel); + state = LQPRS_WAITLEVEL; + } + else + UNCHAR; + break; + case LQPRS_WAITFNUM: + if (t_iseq(ptr, ',')) + state = LQPRS_WAITSNUM; + else if (t_isdigit(ptr)) + { + int low = atoi(ptr); + + if (low < 0 || low > LTREE_MAX_LEVELS) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("lquery syntax error"), + errdetail("Low limit (%d) exceeds the maximum allowed (%d), at character %d.", + low, LTREE_MAX_LEVELS, pos))); + + curqlevel->low = (uint16) low; + state = LQPRS_WAITND; + } + else + UNCHAR; + break; + case LQPRS_WAITSNUM: + if (t_isdigit(ptr)) + { + int high = atoi(ptr); + + if (high < 0 || high > LTREE_MAX_LEVELS) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("lquery syntax error"), + errdetail("High limit (%d) exceeds the maximum allowed (%d), at character %d.", + high, LTREE_MAX_LEVELS, pos))); + else if (curqlevel->low > high) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("lquery syntax error"), + errdetail("Low limit (%d) is greater than high limit (%d), at character %d.", + curqlevel->low, high, pos))); + + curqlevel->high = (uint16) high; + state = LQPRS_WAITCLOSE; + } + else if (t_iseq(ptr, '}')) + { + curqlevel->high = LTREE_MAX_LEVELS; + state = LQPRS_WAITEND; + } + else + UNCHAR; + break; + case LQPRS_WAITCLOSE: + if (t_iseq(ptr, '}')) + state = LQPRS_WAITEND; + else if (!t_isdigit(ptr)) + UNCHAR; + break; + case LQPRS_WAITND: + if (t_iseq(ptr, '}')) + { + curqlevel->high = curqlevel->low; + state = LQPRS_WAITEND; + } + else if (t_iseq(ptr, ',')) + state = LQPRS_WAITSNUM; + else if (!t_isdigit(ptr)) + UNCHAR; + break; + case LQPRS_WAITEND: + if (t_iseq(ptr, '.')) + { + state = LQPRS_WAITLEVEL; + curqlevel = NEXTLEV(curqlevel); + } + else + UNCHAR; + break; + default: + elog(ERROR, "internal error in lquery parser"); + } + + ptr += charlen; + if (state == LQPRS_WAITDELIM) + lptr->wlen++; + pos++; + } + + if (state == LQPRS_WAITDELIM) + finish_nodeitem(lptr, ptr, true, pos); + else if (state == LQPRS_WAITOPEN) + curqlevel->high = LTREE_MAX_LEVELS; + else if (state != LQPRS_WAITEND) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("lquery syntax error"), + errdetail("Unexpected end of input."))); + + curqlevel = tmpql; + totallen = LQUERY_HDRSIZE; + while ((char *) curqlevel - (char *) tmpql < num * ITEMSIZE) + { + totallen += LQL_HDRSIZE; + if (curqlevel->numvar) + { + lptr = GETVAR(curqlevel); + while (lptr - GETVAR(curqlevel) < curqlevel->numvar) + { + totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len); + lptr++; + } + } + curqlevel = NEXTLEV(curqlevel); + } + + result = (lquery *) palloc0(totallen); + SET_VARSIZE(result, totallen); + result->numlevel = num; + result->firstgood = 0; + result->flag = 0; + if (hasnot) + result->flag |= LQUERY_HASNOT; + cur = LQUERY_FIRST(result); + curqlevel = tmpql; + while ((char *) curqlevel - (char *) tmpql < num * ITEMSIZE) + { + memcpy(cur, curqlevel, LQL_HDRSIZE); + cur->totallen = LQL_HDRSIZE; + if (curqlevel->numvar) + { + lrptr = LQL_FIRST(cur); + lptr = GETVAR(curqlevel); + while (lptr - GETVAR(curqlevel) < curqlevel->numvar) + { + cur->totallen += MAXALIGN(LVAR_HDRSIZE + lptr->len); + lrptr->len = lptr->len; + lrptr->flag = lptr->flag; + lrptr->val = ltree_crc32_sz(lptr->start, lptr->len); + memcpy(lrptr->name, lptr->start, lptr->len); + lptr++; + lrptr = LVAR_NEXT(lrptr); + } + pfree(GETVAR(curqlevel)); + if (cur->numvar > 1 || cur->flag != 0) + { + /* Not a simple match */ + wasbad = true; + } + else if (wasbad == false) + { + /* count leading simple matches */ + (result->firstgood)++; + } + } + else + { + /* '*', so this isn't a simple match */ + wasbad = true; + } + curqlevel = NEXTLEV(curqlevel); + cur = LQL_NEXT(cur); + } + + pfree(tmpql); + return result; + +#undef UNCHAR +} + +/* + * Close out parsing an ltree or lquery nodeitem: + * compute the correct length, and complain if it's not OK + */ +static void +finish_nodeitem(nodeitem *lptr, const char *ptr, bool is_lquery, int pos) +{ + if (is_lquery) + { + /* + * Back up over any flag characters, and discount them from length and + * position. + */ + while (ptr > lptr->start && strchr("@*%", ptr[-1]) != NULL) + { + ptr--; + lptr->wlen--; + pos--; + } + } + + /* Now compute the byte length, which we weren't tracking before. */ + lptr->len = ptr - lptr->start; + + /* Complain if it's empty or too long */ + if (lptr->len == 0) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + is_lquery ? + errmsg("lquery syntax error at character %d", pos) : + errmsg("ltree syntax error at character %d", pos), + errdetail("Empty labels are not allowed."))); + if (lptr->wlen > LTREE_LABEL_MAX_CHARS) + ereport(ERROR, + (errcode(ERRCODE_NAME_TOO_LONG), + errmsg("label string is too long"), + errdetail("Label length is %d, must be at most %d, at character %d.", + lptr->wlen, LTREE_LABEL_MAX_CHARS, pos))); +} + +/* + * expects an lquery + * returns a null terminated string + */ +static char * +deparse_lquery(const lquery *in) +{ + char *buf, + *ptr; + int i, + j, + totallen = 1; + lquery_level *curqlevel; + lquery_variant *curtlevel; + + curqlevel = LQUERY_FIRST(in); + for (i = 0; i < in->numlevel; i++) + { + totallen++; + if (curqlevel->numvar) + { + totallen += 1 + (curqlevel->numvar * 4) + curqlevel->totallen; + if (curqlevel->flag & LQL_COUNT) + totallen += 2 * 11 + 3; + } + else + totallen += 2 * 11 + 4; + curqlevel = LQL_NEXT(curqlevel); + } + + ptr = buf = (char *) palloc(totallen); + curqlevel = LQUERY_FIRST(in); + for (i = 0; i < in->numlevel; i++) + { + if (i != 0) + { + *ptr = '.'; + ptr++; + } + if (curqlevel->numvar) + { + if (curqlevel->flag & LQL_NOT) + { + *ptr = '!'; + ptr++; + } + curtlevel = LQL_FIRST(curqlevel); + for (j = 0; j < curqlevel->numvar; j++) + { + if (j != 0) + { + *ptr = '|'; + ptr++; + } + memcpy(ptr, curtlevel->name, curtlevel->len); + ptr += curtlevel->len; + if ((curtlevel->flag & LVAR_SUBLEXEME)) + { + *ptr = '%'; + ptr++; + } + if ((curtlevel->flag & LVAR_INCASE)) + { + *ptr = '@'; + ptr++; + } + if ((curtlevel->flag & LVAR_ANYEND)) + { + *ptr = '*'; + ptr++; + } + curtlevel = LVAR_NEXT(curtlevel); + } + } + else + { + *ptr = '*'; + ptr++; + } + + if ((curqlevel->flag & LQL_COUNT) || curqlevel->numvar == 0) + { + if (curqlevel->low == curqlevel->high) + { + sprintf(ptr, "{%d}", curqlevel->low); + } + else if (curqlevel->low == 0) + { + if (curqlevel->high == LTREE_MAX_LEVELS) + { + if (curqlevel->numvar == 0) + { + /* This is default for '*', so print nothing */ + *ptr = '\0'; + } + else + sprintf(ptr, "{,}"); + } + else + sprintf(ptr, "{,%d}", curqlevel->high); + } + else if (curqlevel->high == LTREE_MAX_LEVELS) + { + sprintf(ptr, "{%d,}", curqlevel->low); + } + else + sprintf(ptr, "{%d,%d}", curqlevel->low, curqlevel->high); + ptr = strchr(ptr, '\0'); + } + + curqlevel = LQL_NEXT(curqlevel); + } + + *ptr = '\0'; + return buf; +} + +/* + * Basic lquery I/O functions + */ +PG_FUNCTION_INFO_V1(lquery_in); +Datum +lquery_in(PG_FUNCTION_ARGS) +{ + char *buf = (char *) PG_GETARG_POINTER(0); + + PG_RETURN_POINTER(parse_lquery(buf)); +} + +PG_FUNCTION_INFO_V1(lquery_out); +Datum +lquery_out(PG_FUNCTION_ARGS) +{ + lquery *in = PG_GETARG_LQUERY_P(0); + + PG_RETURN_POINTER(deparse_lquery(in)); +} + +/* + * lquery type send function + * + * The type is sent as text in binary mode, so this is almost the same + * as the output function, but it's prefixed with a version number so we + * can change the binary format sent in future if necessary. For now, + * only version 1 is supported. + */ +PG_FUNCTION_INFO_V1(lquery_send); +Datum +lquery_send(PG_FUNCTION_ARGS) +{ + lquery *in = PG_GETARG_LQUERY_P(0); + StringInfoData buf; + int version = 1; + char *res = deparse_lquery(in); + + pq_begintypsend(&buf); + pq_sendint8(&buf, version); + pq_sendtext(&buf, res, strlen(res)); + pfree(res); + + PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); +} + +/* + * lquery type recv function + * + * The type is sent as text in binary mode, so this is almost the same + * as the input function, but it's prefixed with a version number so we + * can change the binary format sent in future if necessary. For now, + * only version 1 is supported. + */ +PG_FUNCTION_INFO_V1(lquery_recv); +Datum +lquery_recv(PG_FUNCTION_ARGS) +{ + StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); + int version = pq_getmsgint(buf, 1); + char *str; + int nbytes; + lquery *res; + + if (version != 1) + elog(ERROR, "unsupported lquery version number %d", version); + + str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); + res = parse_lquery(str); + pfree(str); + + PG_RETURN_POINTER(res); +} diff --git a/contrib/ltree/ltree_op.c b/contrib/ltree/ltree_op.c new file mode 100644 index 0000000..778dbf1 --- /dev/null +++ b/contrib/ltree/ltree_op.c @@ -0,0 +1,590 @@ +/* + * op function for ltree + * Teodor Sigaev <teodor@stack.net> + * contrib/ltree/ltree_op.c + */ +#include "postgres.h" + +#include <ctype.h> + +#include "access/htup_details.h" +#include "catalog/pg_statistic.h" +#include "ltree.h" +#include "utils/builtins.h" +#include "utils/lsyscache.h" +#include "utils/selfuncs.h" + +PG_MODULE_MAGIC; + +/* compare functions */ +PG_FUNCTION_INFO_V1(ltree_cmp); +PG_FUNCTION_INFO_V1(ltree_lt); +PG_FUNCTION_INFO_V1(ltree_le); +PG_FUNCTION_INFO_V1(ltree_eq); +PG_FUNCTION_INFO_V1(ltree_ne); +PG_FUNCTION_INFO_V1(ltree_ge); +PG_FUNCTION_INFO_V1(ltree_gt); +PG_FUNCTION_INFO_V1(nlevel); +PG_FUNCTION_INFO_V1(ltree_isparent); +PG_FUNCTION_INFO_V1(ltree_risparent); +PG_FUNCTION_INFO_V1(subltree); +PG_FUNCTION_INFO_V1(subpath); +PG_FUNCTION_INFO_V1(ltree_index); +PG_FUNCTION_INFO_V1(ltree_addltree); +PG_FUNCTION_INFO_V1(ltree_addtext); +PG_FUNCTION_INFO_V1(ltree_textadd); +PG_FUNCTION_INFO_V1(lca); +PG_FUNCTION_INFO_V1(ltree2text); +PG_FUNCTION_INFO_V1(text2ltree); +PG_FUNCTION_INFO_V1(ltreeparentsel); + +int +ltree_compare(const ltree *a, const ltree *b) +{ + ltree_level *al = LTREE_FIRST(a); + ltree_level *bl = LTREE_FIRST(b); + int an = a->numlevel; + int bn = b->numlevel; + + while (an > 0 && bn > 0) + { + int res; + + if ((res = memcmp(al->name, bl->name, Min(al->len, bl->len))) == 0) + { + if (al->len != bl->len) + return (al->len - bl->len) * 10 * (an + 1); + } + else + { + if (res < 0) + res = -1; + else + res = 1; + return res * 10 * (an + 1); + } + + an--; + bn--; + al = LEVEL_NEXT(al); + bl = LEVEL_NEXT(bl); + } + + return (a->numlevel - b->numlevel) * 10 * (an + 1); +} + +#define RUNCMP \ +ltree *a = PG_GETARG_LTREE_P(0); \ +ltree *b = PG_GETARG_LTREE_P(1); \ +int res = ltree_compare(a,b); \ +PG_FREE_IF_COPY(a,0); \ +PG_FREE_IF_COPY(b,1) + +Datum +ltree_cmp(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_INT32(res); +} + +Datum +ltree_lt(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_BOOL((res < 0) ? true : false); +} + +Datum +ltree_le(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_BOOL((res <= 0) ? true : false); +} + +Datum +ltree_eq(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_BOOL((res == 0) ? true : false); +} + +Datum +ltree_ge(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_BOOL((res >= 0) ? true : false); +} + +Datum +ltree_gt(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_BOOL((res > 0) ? true : false); +} + +Datum +ltree_ne(PG_FUNCTION_ARGS) +{ + RUNCMP; + PG_RETURN_BOOL((res != 0) ? true : false); +} + +Datum +nlevel(PG_FUNCTION_ARGS) +{ + ltree *a = PG_GETARG_LTREE_P(0); + int res = a->numlevel; + + PG_FREE_IF_COPY(a, 0); + PG_RETURN_INT32(res); +} + +bool +inner_isparent(const ltree *c, const ltree *p) +{ + ltree_level *cl = LTREE_FIRST(c); + ltree_level *pl = LTREE_FIRST(p); + int pn = p->numlevel; + + if (pn > c->numlevel) + return false; + + while (pn > 0) + { + if (cl->len != pl->len) + return false; + if (memcmp(cl->name, pl->name, cl->len) != 0) + return false; + + pn--; + cl = LEVEL_NEXT(cl); + pl = LEVEL_NEXT(pl); + } + return true; +} + +Datum +ltree_isparent(PG_FUNCTION_ARGS) +{ + ltree *c = PG_GETARG_LTREE_P(1); + ltree *p = PG_GETARG_LTREE_P(0); + bool res = inner_isparent(c, p); + + PG_FREE_IF_COPY(c, 1); + PG_FREE_IF_COPY(p, 0); + PG_RETURN_BOOL(res); +} + +Datum +ltree_risparent(PG_FUNCTION_ARGS) +{ + ltree *c = PG_GETARG_LTREE_P(0); + ltree *p = PG_GETARG_LTREE_P(1); + bool res = inner_isparent(c, p); + + PG_FREE_IF_COPY(c, 0); + PG_FREE_IF_COPY(p, 1); + PG_RETURN_BOOL(res); +} + + +static ltree * +inner_subltree(ltree *t, int32 startpos, int32 endpos) +{ + char *start = NULL, + *end = NULL; + ltree_level *ptr = LTREE_FIRST(t); + ltree *res; + int i; + + if (startpos < 0 || endpos < 0 || startpos >= t->numlevel || startpos > endpos) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("invalid positions"))); + + if (endpos > t->numlevel) + endpos = t->numlevel; + + start = end = (char *) ptr; + for (i = 0; i < endpos; i++) + { + if (i == startpos) + start = (char *) ptr; + if (i == endpos - 1) + { + end = (char *) LEVEL_NEXT(ptr); + break; + } + ptr = LEVEL_NEXT(ptr); + } + + res = (ltree *) palloc0(LTREE_HDRSIZE + (end - start)); + SET_VARSIZE(res, LTREE_HDRSIZE + (end - start)); + res->numlevel = endpos - startpos; + + memcpy(LTREE_FIRST(res), start, end - start); + + return res; +} + +Datum +subltree(PG_FUNCTION_ARGS) +{ + ltree *t = PG_GETARG_LTREE_P(0); + ltree *res = inner_subltree(t, PG_GETARG_INT32(1), PG_GETARG_INT32(2)); + + PG_FREE_IF_COPY(t, 0); + PG_RETURN_POINTER(res); +} + +Datum +subpath(PG_FUNCTION_ARGS) +{ + ltree *t = PG_GETARG_LTREE_P(0); + int32 start = PG_GETARG_INT32(1); + int32 len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0; + int32 end; + ltree *res; + + end = start + len; + + if (start < 0) + { + start = t->numlevel + start; + end = start + len; + } + if (start < 0) + { /* start > t->numlevel */ + start = t->numlevel + start; + end = start + len; + } + + if (len < 0) + end = t->numlevel + len; + else if (len == 0) + end = (fcinfo->nargs == 3) ? start : 0xffff; + + res = inner_subltree(t, start, end); + + PG_FREE_IF_COPY(t, 0); + PG_RETURN_POINTER(res); +} + +static ltree * +ltree_concat(ltree *a, ltree *b) +{ + ltree *r; + int numlevel = (int) a->numlevel + b->numlevel; + + if (numlevel > LTREE_MAX_LEVELS) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("number of ltree levels (%d) exceeds the maximum allowed (%d)", + numlevel, LTREE_MAX_LEVELS))); + + r = (ltree *) palloc0(VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE); + SET_VARSIZE(r, VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE); + r->numlevel = (uint16) numlevel; + + memcpy(LTREE_FIRST(r), LTREE_FIRST(a), VARSIZE(a) - LTREE_HDRSIZE); + memcpy(((char *) LTREE_FIRST(r)) + VARSIZE(a) - LTREE_HDRSIZE, + LTREE_FIRST(b), + VARSIZE(b) - LTREE_HDRSIZE); + return r; +} + +Datum +ltree_addltree(PG_FUNCTION_ARGS) +{ + ltree *a = PG_GETARG_LTREE_P(0); + ltree *b = PG_GETARG_LTREE_P(1); + ltree *r; + + r = ltree_concat(a, b); + PG_FREE_IF_COPY(a, 0); + PG_FREE_IF_COPY(b, 1); + PG_RETURN_POINTER(r); +} + +Datum +ltree_addtext(PG_FUNCTION_ARGS) +{ + ltree *a = PG_GETARG_LTREE_P(0); + text *b = PG_GETARG_TEXT_PP(1); + char *s; + ltree *r, + *tmp; + + s = text_to_cstring(b); + + tmp = (ltree *) DatumGetPointer(DirectFunctionCall1(ltree_in, + PointerGetDatum(s))); + + pfree(s); + + r = ltree_concat(a, tmp); + + pfree(tmp); + + PG_FREE_IF_COPY(a, 0); + PG_FREE_IF_COPY(b, 1); + PG_RETURN_POINTER(r); +} + +Datum +ltree_index(PG_FUNCTION_ARGS) +{ + ltree *a = PG_GETARG_LTREE_P(0); + ltree *b = PG_GETARG_LTREE_P(1); + int start = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0; + int i, + j; + ltree_level *startptr, + *aptr, + *bptr; + bool found = false; + + if (start < 0) + { + if (-start >= a->numlevel) + start = 0; + else + start = (int) (a->numlevel) + start; + } + + if (a->numlevel - start < b->numlevel || a->numlevel == 0 || b->numlevel == 0) + { + PG_FREE_IF_COPY(a, 0); + PG_FREE_IF_COPY(b, 1); + PG_RETURN_INT32(-1); + } + + startptr = LTREE_FIRST(a); + for (i = 0; i <= a->numlevel - b->numlevel; i++) + { + if (i >= start) + { + aptr = startptr; + bptr = LTREE_FIRST(b); + for (j = 0; j < b->numlevel; j++) + { + if (!(aptr->len == bptr->len && memcmp(aptr->name, bptr->name, aptr->len) == 0)) + break; + aptr = LEVEL_NEXT(aptr); + bptr = LEVEL_NEXT(bptr); + } + + if (j == b->numlevel) + { + found = true; + break; + } + } + startptr = LEVEL_NEXT(startptr); + } + + if (!found) + i = -1; + + PG_FREE_IF_COPY(a, 0); + PG_FREE_IF_COPY(b, 1); + PG_RETURN_INT32(i); +} + +Datum +ltree_textadd(PG_FUNCTION_ARGS) +{ + ltree *a = PG_GETARG_LTREE_P(1); + text *b = PG_GETARG_TEXT_PP(0); + char *s; + ltree *r, + *tmp; + + s = text_to_cstring(b); + + tmp = (ltree *) DatumGetPointer(DirectFunctionCall1(ltree_in, + PointerGetDatum(s))); + + pfree(s); + + r = ltree_concat(tmp, a); + + pfree(tmp); + + PG_FREE_IF_COPY(a, 1); + PG_FREE_IF_COPY(b, 0); + PG_RETURN_POINTER(r); +} + +/* + * Common code for variants of lca(), find longest common ancestor of inputs + * + * Returns NULL if there is no common ancestor, ie, the longest common + * prefix is empty. + */ +ltree * +lca_inner(ltree **a, int len) +{ + int tmp, + num, + i, + reslen; + ltree **ptr; + ltree_level *l1, + *l2; + ltree *res; + + if (len <= 0) + return NULL; /* no inputs? */ + if ((*a)->numlevel == 0) + return NULL; /* any empty input means NULL result */ + + /* num is the length of the longest common ancestor so far */ + num = (*a)->numlevel - 1; + + /* Compare each additional input to *a */ + ptr = a + 1; + while (ptr - a < len) + { + if ((*ptr)->numlevel == 0) + return NULL; + else if ((*ptr)->numlevel == 1) + num = 0; + else + { + l1 = LTREE_FIRST(*a); + l2 = LTREE_FIRST(*ptr); + tmp = Min(num, (*ptr)->numlevel - 1); + num = 0; + for (i = 0; i < tmp; i++) + { + if (l1->len == l2->len && + memcmp(l1->name, l2->name, l1->len) == 0) + num = i + 1; + else + break; + l1 = LEVEL_NEXT(l1); + l2 = LEVEL_NEXT(l2); + } + } + ptr++; + } + + /* Now compute size of result ... */ + reslen = LTREE_HDRSIZE; + l1 = LTREE_FIRST(*a); + for (i = 0; i < num; i++) + { + reslen += MAXALIGN(l1->len + LEVEL_HDRSIZE); + l1 = LEVEL_NEXT(l1); + } + + /* ... and construct it by copying from *a */ + res = (ltree *) palloc0(reslen); + SET_VARSIZE(res, reslen); + res->numlevel = num; + + l1 = LTREE_FIRST(*a); + l2 = LTREE_FIRST(res); + + for (i = 0; i < num; i++) + { + memcpy(l2, l1, MAXALIGN(l1->len + LEVEL_HDRSIZE)); + l1 = LEVEL_NEXT(l1); + l2 = LEVEL_NEXT(l2); + } + + return res; +} + +Datum +lca(PG_FUNCTION_ARGS) +{ + int i; + ltree **a, + *res; + + a = (ltree **) palloc(sizeof(ltree *) * fcinfo->nargs); + for (i = 0; i < fcinfo->nargs; i++) + a[i] = PG_GETARG_LTREE_P(i); + res = lca_inner(a, (int) fcinfo->nargs); + for (i = 0; i < fcinfo->nargs; i++) + PG_FREE_IF_COPY(a[i], i); + pfree(a); + + if (res) + PG_RETURN_POINTER(res); + else + PG_RETURN_NULL(); +} + +Datum +text2ltree(PG_FUNCTION_ARGS) +{ + text *in = PG_GETARG_TEXT_PP(0); + char *s; + ltree *out; + + s = text_to_cstring(in); + + out = (ltree *) DatumGetPointer(DirectFunctionCall1(ltree_in, + PointerGetDatum(s))); + pfree(s); + PG_FREE_IF_COPY(in, 0); + PG_RETURN_POINTER(out); +} + + +Datum +ltree2text(PG_FUNCTION_ARGS) +{ + ltree *in = PG_GETARG_LTREE_P(0); + char *ptr; + int i; + ltree_level *curlevel; + text *out; + + out = (text *) palloc(VARSIZE(in) + VARHDRSZ); + ptr = VARDATA(out); + curlevel = LTREE_FIRST(in); + for (i = 0; i < in->numlevel; i++) + { + if (i != 0) + { + *ptr = '.'; + ptr++; + } + memcpy(ptr, curlevel->name, curlevel->len); + ptr += curlevel->len; + curlevel = LEVEL_NEXT(curlevel); + } + + SET_VARSIZE(out, ptr - ((char *) out)); + PG_FREE_IF_COPY(in, 0); + + PG_RETURN_POINTER(out); +} + + +/* + * ltreeparentsel - Selectivity of parent relationship for ltree data types. + * + * This function is not used anymore, if the ltree extension has been + * updated to 1.2 or later. + */ +Datum +ltreeparentsel(PG_FUNCTION_ARGS) +{ + PlannerInfo *root = (PlannerInfo *) PG_GETARG_POINTER(0); + Oid operator = PG_GETARG_OID(1); + List *args = (List *) PG_GETARG_POINTER(2); + int varRelid = PG_GETARG_INT32(3); + double selec; + + /* Use generic restriction selectivity logic, with default 0.001. */ + selec = generic_restriction_selectivity(root, operator, InvalidOid, + args, varRelid, + 0.001); + + PG_RETURN_FLOAT8((float8) selec); +} diff --git a/contrib/ltree/ltreetest.sql b/contrib/ltree/ltreetest.sql new file mode 100644 index 0000000..d6996ca --- /dev/null +++ b/contrib/ltree/ltreetest.sql @@ -0,0 +1,21 @@ +/* contrib/ltree/ltreetest.sql */ + +-- Adjust this setting to control where the objects get created. +SET search_path = public; + +CREATE TABLE test ( path ltree); +INSERT INTO test VALUES ('Top'); +INSERT INTO test VALUES ('Top.Science'); +INSERT INTO test VALUES ('Top.Science.Astronomy'); +INSERT INTO test VALUES ('Top.Science.Astronomy.Astrophysics'); +INSERT INTO test VALUES ('Top.Science.Astronomy.Cosmology'); +INSERT INTO test VALUES ('Top.Hobbies'); +INSERT INTO test VALUES ('Top.Hobbies.Amateurs_Astronomy'); +INSERT INTO test VALUES ('Top.Collections'); +INSERT INTO test VALUES ('Top.Collections.Pictures'); +INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy'); +INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy.Stars'); +INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy.Galaxies'); +INSERT INTO test VALUES ('Top.Collections.Pictures.Astronomy.Astronauts'); +CREATE INDEX path_gist_idx ON test USING gist(path); +CREATE INDEX path_idx ON test USING btree(path); diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c new file mode 100644 index 0000000..d967f92 --- /dev/null +++ b/contrib/ltree/ltxtquery_io.c @@ -0,0 +1,600 @@ +/* + * txtquery io + * Teodor Sigaev <teodor@stack.net> + * contrib/ltree/ltxtquery_io.c + */ +#include "postgres.h" + +#include <ctype.h> + +#include "crc32.h" +#include "libpq/pqformat.h" +#include "ltree.h" +#include "miscadmin.h" + + +/* parser's states */ +#define WAITOPERAND 1 +#define INOPERAND 2 +#define WAITOPERATOR 3 + +/* + * node of query tree, also used + * for storing polish notation in parser + */ +typedef struct NODE +{ + int32 type; + int32 val; + int16 distance; + int16 length; + uint16 flag; + struct NODE *next; +} NODE; + +typedef struct +{ + char *buf; + int32 state; + int32 count; + /* reverse polish notation in list (for temporary usage) */ + NODE *str; + /* number in str */ + int32 num; + + /* user-friendly operand */ + int32 lenop; + int32 sumlen; + char *op; + char *curop; +} QPRS_STATE; + +/* + * get token from query string + */ +static int32 +gettoken_query(QPRS_STATE *state, int32 *val, int32 *lenval, char **strval, uint16 *flag) +{ + int charlen; + + for (;;) + { + charlen = pg_mblen(state->buf); + + switch (state->state) + { + case WAITOPERAND: + if (charlen == 1 && t_iseq(state->buf, '!')) + { + (state->buf)++; + *val = (int32) '!'; + return OPR; + } + else if (charlen == 1 && t_iseq(state->buf, '(')) + { + state->count++; + (state->buf)++; + return OPEN; + } + else if (ISALNUM(state->buf)) + { + state->state = INOPERAND; + *strval = state->buf; + *lenval = charlen; + *flag = 0; + } + else if (!t_isspace(state->buf)) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("operand syntax error"))); + break; + case INOPERAND: + if (ISALNUM(state->buf)) + { + if (*flag) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("modifiers syntax error"))); + *lenval += charlen; + } + else if (charlen == 1 && t_iseq(state->buf, '%')) + *flag |= LVAR_SUBLEXEME; + else if (charlen == 1 && t_iseq(state->buf, '@')) + *flag |= LVAR_INCASE; + else if (charlen == 1 && t_iseq(state->buf, '*')) + *flag |= LVAR_ANYEND; + else + { + state->state = WAITOPERATOR; + return VAL; + } + break; + case WAITOPERATOR: + if (charlen == 1 && (t_iseq(state->buf, '&') || t_iseq(state->buf, '|'))) + { + state->state = WAITOPERAND; + *val = (int32) *(state->buf); + (state->buf)++; + return OPR; + } + else if (charlen == 1 && t_iseq(state->buf, ')')) + { + (state->buf)++; + state->count--; + return (state->count < 0) ? ERR : CLOSE; + } + else if (*(state->buf) == '\0') + return (state->count) ? ERR : END; + else if (charlen == 1 && !t_iseq(state->buf, ' ')) + return ERR; + break; + default: + return ERR; + break; + } + + state->buf += charlen; + } +} + +/* + * push new one in polish notation reverse view + */ +static void +pushquery(QPRS_STATE *state, int32 type, int32 val, int32 distance, int32 lenval, uint16 flag) +{ + NODE *tmp = (NODE *) palloc(sizeof(NODE)); + + tmp->type = type; + tmp->val = val; + tmp->flag = flag; + if (distance > 0xffff) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("value is too big"))); + if (lenval > 0xff) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("operand is too long"))); + tmp->distance = distance; + tmp->length = lenval; + tmp->next = state->str; + state->str = tmp; + state->num++; +} + +/* + * This function is used for query text parsing + */ +static void +pushval_asis(QPRS_STATE *state, int type, char *strval, int lenval, uint16 flag) +{ + if (lenval > 0xffff) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("word is too long"))); + + pushquery(state, type, ltree_crc32_sz(strval, lenval), + state->curop - state->op, lenval, flag); + + while (state->curop - state->op + lenval + 1 >= state->lenop) + { + int32 tmp = state->curop - state->op; + + state->lenop *= 2; + state->op = (char *) repalloc((void *) state->op, state->lenop); + state->curop = state->op + tmp; + } + memcpy((void *) state->curop, (void *) strval, lenval); + state->curop += lenval; + *(state->curop) = '\0'; + state->curop++; + state->sumlen += lenval + 1; +} + +#define STACKDEPTH 32 +/* + * make polish notation of query + */ +static int32 +makepol(QPRS_STATE *state) +{ + int32 val = 0, + type; + int32 lenval = 0; + char *strval = NULL; + int32 stack[STACKDEPTH]; + int32 lenstack = 0; + uint16 flag = 0; + + /* since this function recurses, it could be driven to stack overflow */ + check_stack_depth(); + + while ((type = gettoken_query(state, &val, &lenval, &strval, &flag)) != END) + { + switch (type) + { + case VAL: + pushval_asis(state, VAL, strval, lenval, flag); + while (lenstack && (stack[lenstack - 1] == (int32) '&' || + stack[lenstack - 1] == (int32) '!')) + { + lenstack--; + pushquery(state, OPR, stack[lenstack], 0, 0, 0); + } + break; + case OPR: + if (lenstack && val == (int32) '|') + pushquery(state, OPR, val, 0, 0, 0); + else + { + if (lenstack == STACKDEPTH) + /* internal error */ + elog(ERROR, "stack too short"); + stack[lenstack] = val; + lenstack++; + } + break; + case OPEN: + if (makepol(state) == ERR) + return ERR; + while (lenstack && (stack[lenstack - 1] == (int32) '&' || + stack[lenstack - 1] == (int32) '!')) + { + lenstack--; + pushquery(state, OPR, stack[lenstack], 0, 0, 0); + } + break; + case CLOSE: + while (lenstack) + { + lenstack--; + pushquery(state, OPR, stack[lenstack], 0, 0, 0); + }; + return END; + break; + case ERR: + default: + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error"))); + + return ERR; + + } + } + while (lenstack) + { + lenstack--; + pushquery(state, OPR, stack[lenstack], 0, 0, 0); + }; + return END; +} + +static void +findoprnd(ITEM *ptr, int32 *pos) +{ + /* since this function recurses, it could be driven to stack overflow. */ + check_stack_depth(); + + if (ptr[*pos].type == VAL || ptr[*pos].type == VALTRUE) + { + ptr[*pos].left = 0; + (*pos)++; + } + else if (ptr[*pos].val == (int32) '!') + { + ptr[*pos].left = 1; + (*pos)++; + findoprnd(ptr, pos); + } + else + { + ITEM *curitem = &ptr[*pos]; + int32 tmp = *pos; + + (*pos)++; + findoprnd(ptr, pos); + curitem->left = *pos - tmp; + findoprnd(ptr, pos); + } +} + + +/* + * input + */ +static ltxtquery * +queryin(char *buf) +{ + QPRS_STATE state; + int32 i; + ltxtquery *query; + int32 commonlen; + ITEM *ptr; + NODE *tmp; + int32 pos = 0; + +#ifdef BS_DEBUG + char pbuf[16384], + *cur; +#endif + + /* init state */ + state.buf = buf; + state.state = WAITOPERAND; + state.count = 0; + state.num = 0; + state.str = NULL; + + /* init list of operand */ + state.sumlen = 0; + state.lenop = 64; + state.curop = state.op = (char *) palloc(state.lenop); + *(state.curop) = '\0'; + + /* parse query & make polish notation (postfix, but in reverse order) */ + makepol(&state); + if (!state.num) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error"), + errdetail("Empty query."))); + + if (LTXTQUERY_TOO_BIG(state.num, state.sumlen)) + ereport(ERROR, + (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), + errmsg("ltxtquery is too large"))); + commonlen = COMPUTESIZE(state.num, state.sumlen); + + query = (ltxtquery *) palloc0(commonlen); + SET_VARSIZE(query, commonlen); + query->size = state.num; + ptr = GETQUERY(query); + + /* set item in polish notation */ + for (i = 0; i < state.num; i++) + { + ptr[i].type = state.str->type; + ptr[i].val = state.str->val; + ptr[i].distance = state.str->distance; + ptr[i].length = state.str->length; + ptr[i].flag = state.str->flag; + tmp = state.str->next; + pfree(state.str); + state.str = tmp; + } + + /* set user-friendly operand view */ + memcpy((void *) GETOPERAND(query), (void *) state.op, state.sumlen); + pfree(state.op); + + /* set left operand's position for every operator */ + pos = 0; + findoprnd(ptr, &pos); + + return query; +} + +/* + * in without morphology + */ +PG_FUNCTION_INFO_V1(ltxtq_in); +Datum +ltxtq_in(PG_FUNCTION_ARGS) +{ + PG_RETURN_POINTER(queryin((char *) PG_GETARG_POINTER(0))); +} + +/* + * ltxtquery type recv function + * + * The type is sent as text in binary mode, so this is almost the same + * as the input function, but it's prefixed with a version number so we + * can change the binary format sent in future if necessary. For now, + * only version 1 is supported. + */ +PG_FUNCTION_INFO_V1(ltxtq_recv); +Datum +ltxtq_recv(PG_FUNCTION_ARGS) +{ + StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); + int version = pq_getmsgint(buf, 1); + char *str; + int nbytes; + ltxtquery *res; + + if (version != 1) + elog(ERROR, "unsupported ltxtquery version number %d", version); + + str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes); + res = queryin(str); + pfree(str); + + PG_RETURN_POINTER(res); +} + +/* + * out function + */ +typedef struct +{ + ITEM *curpol; + char *buf; + char *cur; + char *op; + int32 buflen; +} INFIX; + +#define RESIZEBUF(inf,addsize) \ +while( ( (inf)->cur - (inf)->buf ) + (addsize) + 1 >= (inf)->buflen ) \ +{ \ + int32 len = (inf)->cur - (inf)->buf; \ + (inf)->buflen *= 2; \ + (inf)->buf = (char*) repalloc( (void*)(inf)->buf, (inf)->buflen ); \ + (inf)->cur = (inf)->buf + len; \ +} + +/* + * recursive walk on tree and print it in + * infix (human-readable) view + */ +static void +infix(INFIX *in, bool first) +{ + /* since this function recurses, it could be driven to stack overflow. */ + check_stack_depth(); + + if (in->curpol->type == VAL) + { + char *op = in->op + in->curpol->distance; + + RESIZEBUF(in, in->curpol->length * 2 + 5); + while (*op) + { + *(in->cur) = *op; + op++; + in->cur++; + } + if (in->curpol->flag & LVAR_SUBLEXEME) + { + *(in->cur) = '%'; + in->cur++; + } + if (in->curpol->flag & LVAR_INCASE) + { + *(in->cur) = '@'; + in->cur++; + } + if (in->curpol->flag & LVAR_ANYEND) + { + *(in->cur) = '*'; + in->cur++; + } + *(in->cur) = '\0'; + in->curpol++; + } + else if (in->curpol->val == (int32) '!') + { + bool isopr = false; + + RESIZEBUF(in, 1); + *(in->cur) = '!'; + in->cur++; + *(in->cur) = '\0'; + in->curpol++; + if (in->curpol->type == OPR) + { + isopr = true; + RESIZEBUF(in, 2); + sprintf(in->cur, "( "); + in->cur = strchr(in->cur, '\0'); + } + infix(in, isopr); + if (isopr) + { + RESIZEBUF(in, 2); + sprintf(in->cur, " )"); + in->cur = strchr(in->cur, '\0'); + } + } + else + { + int32 op = in->curpol->val; + INFIX nrm; + + in->curpol++; + if (op == (int32) '|' && !first) + { + RESIZEBUF(in, 2); + sprintf(in->cur, "( "); + in->cur = strchr(in->cur, '\0'); + } + + nrm.curpol = in->curpol; + nrm.op = in->op; + nrm.buflen = 16; + nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen); + + /* get right operand */ + infix(&nrm, false); + + /* get & print left operand */ + in->curpol = nrm.curpol; + infix(in, false); + + /* print operator & right operand */ + RESIZEBUF(in, 3 + (nrm.cur - nrm.buf)); + sprintf(in->cur, " %c %s", op, nrm.buf); + in->cur = strchr(in->cur, '\0'); + pfree(nrm.buf); + + if (op == (int32) '|' && !first) + { + RESIZEBUF(in, 2); + sprintf(in->cur, " )"); + in->cur = strchr(in->cur, '\0'); + } + } +} + +PG_FUNCTION_INFO_V1(ltxtq_out); +Datum +ltxtq_out(PG_FUNCTION_ARGS) +{ + ltxtquery *query = PG_GETARG_LTXTQUERY_P(0); + INFIX nrm; + + if (query->size == 0) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error"), + errdetail("Empty query."))); + + nrm.curpol = GETQUERY(query); + nrm.buflen = 32; + nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen); + *(nrm.cur) = '\0'; + nrm.op = GETOPERAND(query); + infix(&nrm, true); + + PG_RETURN_POINTER(nrm.buf); +} + +/* + * ltxtquery type send function + * + * The type is sent as text in binary mode, so this is almost the same + * as the output function, but it's prefixed with a version number so we + * can change the binary format sent in future if necessary. For now, + * only version 1 is supported. + */ +PG_FUNCTION_INFO_V1(ltxtq_send); +Datum +ltxtq_send(PG_FUNCTION_ARGS) +{ + ltxtquery *query = PG_GETARG_LTXTQUERY_P(0); + StringInfoData buf; + int version = 1; + INFIX nrm; + + if (query->size == 0) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("syntax error"), + errdetail("Empty query."))); + + nrm.curpol = GETQUERY(query); + nrm.buflen = 32; + nrm.cur = nrm.buf = (char *) palloc(sizeof(char) * nrm.buflen); + *(nrm.cur) = '\0'; + nrm.op = GETOPERAND(query); + infix(&nrm, true); + + pq_begintypsend(&buf); + pq_sendint8(&buf, version); + pq_sendtext(&buf, nrm.buf, strlen(nrm.buf)); + pfree(nrm.buf); + + PG_RETURN_BYTEA_P(pq_endtypsend(&buf)); +} diff --git a/contrib/ltree/ltxtquery_op.c b/contrib/ltree/ltxtquery_op.c new file mode 100644 index 0000000..002102c --- /dev/null +++ b/contrib/ltree/ltxtquery_op.c @@ -0,0 +1,111 @@ +/* + * txtquery operations with ltree + * Teodor Sigaev <teodor@stack.net> + * contrib/ltree/ltxtquery_op.c + */ +#include "postgres.h" + +#include <ctype.h> + +#include "ltree.h" +#include "miscadmin.h" + +PG_FUNCTION_INFO_V1(ltxtq_exec); +PG_FUNCTION_INFO_V1(ltxtq_rexec); + +/* + * check for boolean condition + */ +bool +ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool (*chkcond) (void *checkval, ITEM *val)) +{ + /* since this function recurses, it could be driven to stack overflow */ + check_stack_depth(); + + if (curitem->type == VAL) + return (*chkcond) (checkval, curitem); + else if (curitem->val == (int32) '!') + { + return calcnot ? + ((ltree_execute(curitem + 1, checkval, calcnot, chkcond)) ? false : true) + : true; + } + else if (curitem->val == (int32) '&') + { + if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond)) + return ltree_execute(curitem + 1, checkval, calcnot, chkcond); + else + return false; + } + else + { /* |-operator */ + if (ltree_execute(curitem + curitem->left, checkval, calcnot, chkcond)) + return true; + else + return ltree_execute(curitem + 1, checkval, calcnot, chkcond); + } +} + +typedef struct +{ + ltree *node; + char *operand; +} CHKVAL; + +static bool +checkcondition_str(void *checkval, ITEM *val) +{ + ltree_level *level = LTREE_FIRST(((CHKVAL *) checkval)->node); + int tlen = ((CHKVAL *) checkval)->node->numlevel; + char *op = ((CHKVAL *) checkval)->operand + val->distance; + int (*cmpptr) (const char *, const char *, size_t); + + cmpptr = (val->flag & LVAR_INCASE) ? ltree_strncasecmp : strncmp; + while (tlen > 0) + { + if (val->flag & LVAR_SUBLEXEME) + { + if (compare_subnode(level, op, val->length, cmpptr, (val->flag & LVAR_ANYEND))) + return true; + } + else if ((val->length == level->len || + (level->len > val->length && (val->flag & LVAR_ANYEND))) && + (*cmpptr) (op, level->name, val->length) == 0) + return true; + + tlen--; + level = LEVEL_NEXT(level); + } + + return false; +} + +Datum +ltxtq_exec(PG_FUNCTION_ARGS) +{ + ltree *val = PG_GETARG_LTREE_P(0); + ltxtquery *query = PG_GETARG_LTXTQUERY_P(1); + CHKVAL chkval; + bool result; + + chkval.node = val; + chkval.operand = GETOPERAND(query); + + result = ltree_execute(GETQUERY(query), + &chkval, + true, + checkcondition_str); + + PG_FREE_IF_COPY(val, 0); + PG_FREE_IF_COPY(query, 1); + PG_RETURN_BOOL(result); +} + +Datum +ltxtq_rexec(PG_FUNCTION_ARGS) +{ + PG_RETURN_DATUM(DirectFunctionCall2(ltxtq_exec, + PG_GETARG_DATUM(1), + PG_GETARG_DATUM(0) + )); +} diff --git a/contrib/ltree/sql/ltree.sql b/contrib/ltree/sql/ltree.sql new file mode 100644 index 0000000..bf733ed --- /dev/null +++ b/contrib/ltree/sql/ltree.sql @@ -0,0 +1,384 @@ +CREATE EXTENSION ltree; + +-- Check whether any of our opclasses fail amvalidate +SELECT amname, opcname +FROM pg_opclass opc LEFT JOIN pg_am am ON am.oid = opcmethod +WHERE opc.oid >= 16384 AND NOT amvalidate(opc.oid); + +SELECT ''::ltree; +SELECT '1'::ltree; +SELECT '1.2'::ltree; +SELECT '1.2._3'::ltree; + +-- empty labels not allowed +SELECT '.2.3'::ltree; +SELECT '1..3'::ltree; +SELECT '1.2.'::ltree; + +SELECT repeat('x', 255)::ltree; +SELECT repeat('x', 256)::ltree; + +SELECT ltree2text('1.2.3.34.sdf'); +SELECT text2ltree('1.2.3.34.sdf'); + +SELECT subltree('Top.Child1.Child2',1,2); +SELECT subpath('Top.Child1.Child2',1,2); +SELECT subpath('Top.Child1.Child2',-1,1); +SELECT subpath('Top.Child1.Child2',0,-2); +SELECT subpath('Top.Child1.Child2',0,-1); +SELECT subpath('Top.Child1.Child2',0,0); +SELECT subpath('Top.Child1.Child2',1,0); +SELECT subpath('Top.Child1.Child2',0); +SELECT subpath('Top.Child1.Child2',1); + + +SELECT index('1.2.3.4.5.6','1.2'); +SELECT index('a.1.2.3.4.5.6','1.2'); +SELECT index('a.1.2.3.4.5.6','1.2.3'); +SELECT index('a.1.2.3.4.5.6','1.2.3.j'); +SELECT index('a.1.2.3.4.5.6','1.2.3.j.4.5.5.5.5.5.5'); +SELECT index('a.1.2.3.4.5.6','1.2.3'); +SELECT index('a.1.2.3.4.5.6','6'); +SELECT index('a.1.2.3.4.5.6','6.1'); +SELECT index('a.1.2.3.4.5.6','5.6'); +SELECT index('0.1.2.3.5.4.5.6','5.6'); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',3); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',6); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',7); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-7); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-4); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-3); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-2); +SELECT index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-20000); + + +SELECT 'Top.Child1.Child2'::ltree || 'Child3'::text; +SELECT 'Top.Child1.Child2'::ltree || 'Child3'::ltree; +SELECT 'Top_0'::ltree || 'Top.Child1.Child2'::ltree; +SELECT 'Top.Child1.Child2'::ltree || ''::ltree; +SELECT ''::ltree || 'Top.Child1.Child2'::ltree; + +SELECT lca('{la.2.3,1.2.3.4.5.6,""}') IS NULL; +SELECT lca('{la.2.3,1.2.3.4.5.6}') IS NULL; +SELECT lca('{1.la.2.3,1.2.3.4.5.6}'); +SELECT lca('{1.2.3,1.2.3.4.5.6}'); +SELECT lca('{1.2.3}'); +SELECT lca('{1}'), lca('{1}') IS NULL; +SELECT lca('{}') IS NULL; +SELECT lca('1.la.2.3','1.2.3.4.5.6'); +SELECT lca('1.2.3','1.2.3.4.5.6'); +SELECT lca('1.2.2.3','1.2.3.4.5.6'); +SELECT lca('1.2.2.3','1.2.3.4.5.6',''); +SELECT lca('1.2.2.3','1.2.3.4.5.6','2'); +SELECT lca('1.2.2.3','1.2.3.4.5.6','1'); + + +SELECT '1'::lquery; +SELECT '4|3|2'::lquery; +SELECT '1.2'::lquery; +SELECT '1.4|3|2'::lquery; +SELECT '1.0'::lquery; +SELECT '4|3|2.0'::lquery; +SELECT '1.2.0'::lquery; +SELECT '1.4|3|2.0'::lquery; +SELECT '1.*'::lquery; +SELECT '4|3|2.*'::lquery; +SELECT '1.2.*'::lquery; +SELECT '1.4|3|2.*'::lquery; +SELECT '*.1.*'::lquery; +SELECT '*.4|3|2.*'::lquery; +SELECT '*.1.2.*'::lquery; +SELECT '*.1.4|3|2.*'::lquery; +SELECT '1.*.4|3|2'::lquery; +SELECT '1.*.4|3|2.0'::lquery; +SELECT '1.*.4|3|2.*{1,4}'::lquery; +SELECT '1.*.4|3|2.*{,4}'::lquery; +SELECT '1.*.4|3|2.*{1,}'::lquery; +SELECT '1.*.4|3|2.*{1}'::lquery; +SELECT 'foo.bar{,}.!a*|b{1,}.c{,44}.d{3,4}'::lquery; +SELECT 'foo*@@*'::lquery; +SELECT 'qwerty%@*.tu'::lquery; + +-- empty labels not allowed +SELECT '.2.3'::lquery; +SELECT '1..3'::lquery; +SELECT '1.2.'::lquery; +SELECT '@.2.3'::lquery; +SELECT '1.@.3'::lquery; +SELECT '1.2.@'::lquery; +SELECT '!.2.3'::lquery; +SELECT '1.!.3'::lquery; +SELECT '1.2.!'::lquery; +SELECT '1.2.3|@.4'::lquery; + +SELECT (repeat('x', 255) || '*@@*')::lquery; +SELECT (repeat('x', 256) || '*@@*')::lquery; +SELECT ('!' || repeat('x', 255))::lquery; +SELECT ('!' || repeat('x', 256))::lquery; + +SELECT nlevel('1.2.3.4'); +SELECT nlevel(('1' || repeat('.1', 65534))::ltree); +SELECT nlevel(('1' || repeat('.1', 65535))::ltree); +SELECT nlevel(('1' || repeat('.1', 65534))::ltree || '1'); +SELECT ('1' || repeat('.1', 65534))::lquery IS NULL; +SELECT ('1' || repeat('.1', 65535))::lquery IS NULL; +SELECT '*{65535}'::lquery; +SELECT '*{65536}'::lquery; +SELECT '*{,65534}'::lquery; +SELECT '*{,65535}'::lquery; +SELECT '*{,65536}'::lquery; +SELECT '*{4,3}'::lquery; + +SELECT '1.2'::ltree < '2.2'::ltree; +SELECT '1.2'::ltree <= '2.2'::ltree; +SELECT '2.2'::ltree = '2.2'::ltree; +SELECT '3.2'::ltree >= '2.2'::ltree; +SELECT '3.2'::ltree > '2.2'::ltree; + +SELECT '1.2.3'::ltree @> '1.2.3.4'::ltree; +SELECT '1.2.3.4'::ltree @> '1.2.3.4'::ltree; +SELECT '1.2.3.4.5'::ltree @> '1.2.3.4'::ltree; +SELECT '1.3.3'::ltree @> '1.2.3.4'::ltree; + +SELECT 'a.b.c.d.e'::ltree ~ 'a.b.c.d.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'A.b.c.d.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'A@.b.c.d.e'; +SELECT 'aa.b.c.d.e'::ltree ~ 'A@.b.c.d.e'; +SELECT 'aa.b.c.d.e'::ltree ~ 'A*.b.c.d.e'; +SELECT 'aa.b.c.d.e'::ltree ~ 'A*@.b.c.d.e'; +SELECT 'aa.b.c.d.e'::ltree ~ 'A*@|g.b.c.d.e'; +SELECT 'g.b.c.d.e'::ltree ~ 'A*@|g.b.c.d.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.b.c.d.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{3}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{4}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{,4}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,4}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,3}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,3}'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,4}'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2,5}'; +SELECT 'a.b.c.d.e'::ltree ~ '*{2,3}.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*{2,4}.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*{2,5}.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*.e.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!d'; +SELECT 'a.b.c.d.e'::ltree ~ '!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '!a.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!e'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!e.*'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!d'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*.!f.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.!f.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.a.!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.a.!d'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.a.*.!d.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*.c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.b.*'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*{2}.!b.*.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*{1}.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.!b.*{1}.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.*{1}.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*{1}.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*.!c.*.e'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.*.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*{2}.!b.*.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*{1}.!b.*{1}.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.!b.*{1}.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '!b.*{1}.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*{1}.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ '*.!b.*.!c.*'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{2}.*{2}'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{1}.*{2}.e'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{1}.*{4}'; +SELECT 'a.b.c.d.e'::ltree ~ 'a.*{5}.*'; +SELECT '5.0.1.0'::ltree ~ '5.!0.!0.0'; +SELECT 'a.b'::ltree ~ '!a.!a'; + +SELECT 'a.b.c.d.e'::ltree ~ 'a{,}'; +SELECT 'a.b.c.d.e'::ltree ~ 'a{1,}.*'; +SELECT 'a.b.c.d.e'::ltree ~ 'a{,}.!a{,}'; +SELECT 'a.b.c.d.a'::ltree ~ 'a{,}.!a{,}'; +SELECT 'a.b.c.d.a'::ltree ~ 'a{,2}.!a{1,}'; +SELECT 'a.b.c.d.e'::ltree ~ 'a{,2}.!a{1,}'; +SELECT 'a.b.c.d.e'::ltree ~ '!x{,}'; +SELECT 'a.b.c.d.e'::ltree ~ '!c{,}'; +SELECT 'a.b.c.d.e'::ltree ~ '!c{0,3}.!a{2,}'; +SELECT 'a.b.c.d.e'::ltree ~ '!c{0,3}.!d{2,}.*'; + +SELECT 'QWER_TY'::ltree ~ 'q%@*'; +SELECT 'QWER_TY'::ltree ~ 'q%@*%@*'; +SELECT 'QWER_TY'::ltree ~ 'Q_t%@*'; +SELECT 'QWER_GY'::ltree ~ 'q_t%@*'; + +--ltxtquery +SELECT '!tree & aWdf@*'::ltxtquery; +SELECT 'tree & aw_qw%*'::ltxtquery; +SELECT 'ltree.awdfg'::ltree @ '!tree & aWdf@*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ '!tree & aWdf@*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ '!tree | aWdf@*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree | aWdf@*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf@*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf@'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree & aWdf'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree & awdf*'::ltxtquery; +SELECT 'tree.awdfg'::ltree @ 'tree & aWdfg@'::ltxtquery; +SELECT 'tree.awdfg_qwerty'::ltree @ 'tree & aw_qw%*'::ltxtquery; +SELECT 'tree.awdfg_qwerty'::ltree @ 'tree & aw_rw%*'::ltxtquery; + +--arrays + +SELECT '{1.2.3}'::ltree[] @> '1.2.3.4'; +SELECT '{1.2.3.4}'::ltree[] @> '1.2.3.4'; +SELECT '{1.2.3.4.5}'::ltree[] @> '1.2.3.4'; +SELECT '{1.3.3}'::ltree[] @> '1.2.3.4'; +SELECT '{5.67.8, 1.2.3}'::ltree[] @> '1.2.3.4'; +SELECT '{5.67.8, 1.2.3.4}'::ltree[] @> '1.2.3.4'; +SELECT '{5.67.8, 1.2.3.4.5}'::ltree[] @> '1.2.3.4'; +SELECT '{5.67.8, 1.3.3}'::ltree[] @> '1.2.3.4'; +SELECT '{1.2.3, 7.12.asd}'::ltree[] @> '1.2.3.4'; +SELECT '{1.2.3.4, 7.12.asd}'::ltree[] @> '1.2.3.4'; +SELECT '{1.2.3.4.5, 7.12.asd}'::ltree[] @> '1.2.3.4'; +SELECT '{1.3.3, 7.12.asd}'::ltree[] @> '1.2.3.4'; +SELECT '{ltree.asd, tree.awdfg}'::ltree[] @ 'tree & aWdfg@'::ltxtquery; +SELECT '{j.k.l.m, g.b.c.d.e}'::ltree[] ~ 'A*@|g.b.c.d.e'; +SELECT 'a.b.c.d.e'::ltree ? '{A.b.c.d.e}'; +SELECT 'a.b.c.d.e'::ltree ? '{a.b.c.d.e}'; +SELECT 'a.b.c.d.e'::ltree ? '{A.b.c.d.e, a.*}'; +SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e}'; +SELECT '{a.b.c.d.e,B.df}'::ltree[] ? '{A.b.c.d.e,*.df}'; + +--extractors +SELECT ('{3456,1.2.3.34}'::ltree[] ?@> '1.2.3.4') is null; +SELECT '{3456,1.2.3}'::ltree[] ?@> '1.2.3.4'; +SELECT '{3456,1.2.3.4}'::ltree[] ?<@ '1.2.3'; +SELECT ('{3456,1.2.3.4}'::ltree[] ?<@ '1.2.5') is null; +SELECT '{ltree.asd, tree.awdfg}'::ltree[] ?@ 'tree & aWdfg@'::ltxtquery; +SELECT '{j.k.l.m, g.b.c.d.e}'::ltree[] ?~ 'A*@|g.b.c.d.e'; + +CREATE TABLE ltreetest (t ltree); +\copy ltreetest FROM 'data/ltree.data' + +SELECT * FROM ltreetest WHERE t < '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t <= '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t = '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t >= '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t > '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t @> '1.1.1' order by t asc; +SELECT * FROM ltreetest WHERE t <@ '1.1.1' order by t asc; +SELECT * FROM ltreetest WHERE t @ '23 & 1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '1.1.1.*' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '*.1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '23.*{1}.1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '23.*.1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '23.*.2' order by t asc; +SELECT * FROM ltreetest WHERE t ? '{23.*.1,23.*.2}' order by t asc; + +create unique index tstidx on ltreetest (t); +set enable_seqscan=off; + +SELECT * FROM ltreetest WHERE t < '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t <= '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t = '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t >= '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t > '12.3' order by t asc; + +drop index tstidx; +create index tstidx on ltreetest using gist (t); +set enable_seqscan=off; + +SELECT * FROM ltreetest WHERE t < '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t <= '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t = '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t >= '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t > '12.3' order by t asc; +SELECT * FROM ltreetest WHERE t @> '1.1.1' order by t asc; +SELECT * FROM ltreetest WHERE t <@ '1.1.1' order by t asc; +SELECT * FROM ltreetest WHERE t @ '23 & 1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '1.1.1.*' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '*.1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '23.*{1}.1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '23.*.1' order by t asc; +SELECT * FROM ltreetest WHERE t ~ '23.*.2' order by t asc; +SELECT * FROM ltreetest WHERE t ? '{23.*.1,23.*.2}' order by t asc; + +drop index tstidx; +create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=0)); +create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2025)); +create index tstidx on ltreetest using gist (t gist_ltree_ops(siglen=2024)); + +SELECT count(*) FROM ltreetest WHERE t < '12.3'; +SELECT count(*) FROM ltreetest WHERE t <= '12.3'; +SELECT count(*) FROM ltreetest WHERE t = '12.3'; +SELECT count(*) FROM ltreetest WHERE t >= '12.3'; +SELECT count(*) FROM ltreetest WHERE t > '12.3'; +SELECT count(*) FROM ltreetest WHERE t @> '1.1.1'; +SELECT count(*) FROM ltreetest WHERE t <@ '1.1.1'; +SELECT count(*) FROM ltreetest WHERE t @ '23 & 1'; +SELECT count(*) FROM ltreetest WHERE t ~ '1.1.1.*'; +SELECT count(*) FROM ltreetest WHERE t ~ '*.1'; +SELECT count(*) FROM ltreetest WHERE t ~ '23.*{1}.1'; +SELECT count(*) FROM ltreetest WHERE t ~ '23.*.1'; +SELECT count(*) FROM ltreetest WHERE t ~ '23.*.2'; +SELECT count(*) FROM ltreetest WHERE t ? '{23.*.1,23.*.2}'; + +create table _ltreetest (t ltree[]); +\copy _ltreetest FROM 'data/_ltree.data' + +SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ; +SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ; +SELECT count(*) FROM _ltreetest WHERE t @ '23 & 1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '1.1.1.*' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '*.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ; +SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ; + +create index _tstidx on _ltreetest using gist (t); +set enable_seqscan=off; + +SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ; +SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ; +SELECT count(*) FROM _ltreetest WHERE t @ '23 & 1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '1.1.1.*' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '*.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ; +SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ; + +drop index _tstidx; +create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=0)); +create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2025)); +create index _tstidx on _ltreetest using gist (t gist__ltree_ops(siglen=2024)); + +SELECT count(*) FROM _ltreetest WHERE t @> '1.1.1' ; +SELECT count(*) FROM _ltreetest WHERE t <@ '1.1.1' ; +SELECT count(*) FROM _ltreetest WHERE t @ '23 & 1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '1.1.1.*' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '*.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ; +SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ; +SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ; |