14 #define NEXTVAL(x) ( (lquery*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )
15 #define ISEQ(a,b) ( (a)->numlevel == (b)->numlevel && ltree_compare(a,b)==0 )
24 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
25 errmsg(
"ltree_gist_in() not implemented")));
33 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
34 errmsg(
"ltree_gist_out() not implemented")));
63 if (!right || left == right ||
ISEQ(left, right))
88 #define GETENTRY(vec,pos) ((ltree_gist *) DatumGetPointer((vec)->vector[(pos)].key))
202 bool isalltrue =
false;
204 for (
j = 0;
j < entryvec->
n;
j++)
210 hashing(base, curtree, siglen);
225 ((
unsigned char *) base)[
i] |= sc[
i];
237 if (isalltrue ==
false)
242 if (((
unsigned char *) base)[
i] != 0xff)
270 *penalty =
Max(cmpl, 0) +
Max(cmpr, 0);
286 ((
const RIX *)
b)->r);
312 maxoff = entryvec->
n - 1;
331 lu_l = lu_r = ru_l = ru_r = NULL;
352 ((
unsigned char *) ls)[
i] |= sc[
i];
373 ((
unsigned char *) rs)[
i] |= sc[
i];
384 if (((
unsigned char *) ls)[
i] != 0xff)
397 if (((
unsigned char *) rs)[
i] != 0xff)
446 memcpy(dst, src,
VARSIZE(src));
489 bool isexist =
false;
524 while (an > 0 && bn > 0)
596 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
597 errmsg(
"array must be one-dimensional")));
600 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
601 errmsg(
"array must not contain nulls")));
712 elog(
ERROR,
"unrecognized StrategyNumber: %d", strategy);
726 "signature length in bytes",
#define PG_GETARG_ARRAYTYPE_P(n)
bool array_contains_nulls(ArrayType *array)
int ArrayGetNItems(int ndim, const int *dims)
#define offsetof(type, field)
unsigned int ltree_crc32_sz(const char *buf, int size)
static void PGresult * res
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_FREE_IF_COPY(ptr, n)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_GETARG_POINTER(n)
#define PG_GETARG_UINT16(n)
#define PG_DETOAST_DATUM(datum)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_POINTER(x)
#define PG_RETURN_BOOL(x)
#define gistentryinit(e, k, r, pg, o, l)
#define HASHVAL(val, siglen)
#define HASH(sign, val, siglen)
Assert(fmt[strlen(fmt) - 1] !='\n')
Datum lt_q_regex(PG_FUNCTION_ARGS)
Datum ltq_regex(PG_FUNCTION_ARGS)
bool inner_isparent(const ltree *c, const ltree *p)
#define DatumGetLtreeP(X)
#define FLG_CANLOOKSIGN(x)
#define PG_GETARG_LTXTQUERY_P(n)
#define LTG_RNODE(x, siglen)
#define PG_GETARG_LQUERY_P(n)
#define LTG_GETRNODE(x, siglen)
int ltree_compare(const ltree *a, const ltree *b)
#define LTREE_GET_SIGLEN()
Datum ltxtq_exec(PG_FUNCTION_ARGS)
bool ltree_execute(ITEM *curitem, void *checkval, bool calcnot, bool(*chkcond)(void *checkval, ITEM *val))
#define PG_GETARG_LTREE_P_COPY(n)
#define LQL_CANLOOKSIGN(x)
#define LTREE_SIGLEN_DEFAULT
#define LTG_LNODE(x, siglen)
#define PG_GETARG_LTREE_P(n)
#define LTG_GETLNODE(x, siglen)
Datum ltree_same(PG_FUNCTION_ARGS)
Datum ltree_picksplit(PG_FUNCTION_ARGS)
static bool gist_qe(ltree_gist *key, lquery *query, int siglen)
Datum ltree_union(PG_FUNCTION_ARGS)
Datum ltree_gist_options(PG_FUNCTION_ARGS)
Datum ltree_compress(PG_FUNCTION_ARGS)
static void hashing(BITVECP sign, ltree *t, int siglen)
static bool gist_ischild(ltree_gist *key, ltree *query, int siglen)
static int gist_tqcmp(ltree *t, lquery *q)
#define GETENTRY(vec, pos)
Datum ltree_penalty(PG_FUNCTION_ARGS)
static bool gist_qtxt(ltree_gist *key, ltxtquery *query, int siglen)
Datum ltree_gist_in(PG_FUNCTION_ARGS)
ltree_gist * ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen, ltree *left, ltree *right)
Datum ltree_gist_out(PG_FUNCTION_ARGS)
static bool gist_between(ltree_gist *key, lquery *query, int siglen)
struct LtreeSignature LtreeSignature
static bool arrq_cons(ltree_gist *key, ArrayType *_query, int siglen)
PG_FUNCTION_INFO_V1(ltree_gist_in)
static bool gist_isparent(ltree_gist *key, ltree *query, int siglen)
Datum ltree_decompress(PG_FUNCTION_ARGS)
static int treekey_cmp(const void *a, const void *b)
static bool checkcondition_bit(void *cxt, ITEM *val)
Datum ltree_consistent(PG_FUNCTION_ARGS)
static ltree * copy_ltree(ltree *src)
void pfree(void *pointer)
void * palloc0(Size size)
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
#define qsort(a, b, c, d)
#define DatumGetPointer(X)
#define SET_VARSIZE(PTR, len)
#define PointerGetDatum(X)
static unsigned hash(unsigned *uv, int n)
void init_local_reloptions(local_relopts *opts, Size relopt_struct_size)
void add_local_int_reloption(local_relopts *relopts, const char *name, const char *desc, int default_val, int min_val, int max_val, int offset)
#define BTGreaterStrategyNumber
#define BTLessStrategyNumber
#define BTEqualStrategyNumber
#define BTLessEqualStrategyNumber
#define BTGreaterEqualStrategyNumber
char name[FLEXIBLE_ARRAY_MEMBER]
char name[FLEXIBLE_ARRAY_MEMBER]