PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/gist.h"
#include "access/reloptions.h"
#include "access/stratnum.h"
#include "catalog/pg_type.h"
#include "common/int.h"
#include "hstore.h"
#include "utils/pg_crc.h"
Go to the source code of this file.
Data Structures | |
struct | GistHstoreOptions |
struct | GISTTYPE |
struct | SPLITCOST |
Macros | |
#define | BITBYTE 8 |
#define | SIGLEN_DEFAULT (sizeof(int32) * 4) |
#define | SIGLEN_MAX GISTMaxIndexKeySize |
#define | SIGLENBIT(siglen) ((siglen) * BITBYTE) |
#define | GET_SIGLEN() |
#define | LOOPBYTE(siglen) for (i = 0; i < (siglen); i++) |
#define | LOOPBIT(siglen) for (i = 0; i < SIGLENBIT(siglen); i++) |
#define | GETBYTE(x, i) ( *( (BITVECP)(x) + (int)( (i) / BITBYTE ) ) ) |
#define | GETBITBYTE(x, i) ( (*((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)) |
#define | ALLISTRUE 0x04 |
#define | ISALLTRUE(x) ( ((GISTTYPE*)x)->flag & ALLISTRUE ) |
#define | GTHDRSIZE (VARHDRSZ + sizeof(int32)) |
#define | CALCGTSIZE(flag, siglen) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : (siglen)) ) |
#define | GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) ) |
#define | SUMBIT(val) |
#define | GETENTRY(vec, pos) ((GISTTYPE *) DatumGetPointer((vec)->vector[(pos)].key)) |
#define | WISH_F(a, b, c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) ) |
Typedefs | |
typedef char * | BITVECP |
#define ALLISTRUE 0x04 |
Definition at line 55 of file hstore_gist.c.
#define BITBYTE 8 |
Definition at line 22 of file hstore_gist.c.
Definition at line 60 of file hstore_gist.c.
Definition at line 42 of file hstore_gist.c.
#define GET_SIGLEN | ( | ) |
Definition at line 26 of file hstore_gist.c.
Definition at line 44 of file hstore_gist.c.
Definition at line 41 of file hstore_gist.c.
Definition at line 40 of file hstore_gist.c.
#define GETENTRY | ( | vec, | |
pos | |||
) | ((GISTTYPE *) DatumGetPointer((vec)->vector[(pos)].key)) |
Definition at line 75 of file hstore_gist.c.
Definition at line 62 of file hstore_gist.c.
Definition at line 59 of file hstore_gist.c.
Definition at line 46 of file hstore_gist.c.
Definition at line 45 of file hstore_gist.c.
Definition at line 57 of file hstore_gist.c.
Definition at line 36 of file hstore_gist.c.
Definition at line 33 of file hstore_gist.c.
Definition at line 43 of file hstore_gist.c.
#define SIGLEN_DEFAULT (sizeof(int32) * 4) |
Definition at line 23 of file hstore_gist.c.
#define SIGLEN_MAX GISTMaxIndexKeySize |
Definition at line 24 of file hstore_gist.c.
#define SIGLENBIT | ( | siglen | ) | ((siglen) * BITBYTE) |
Definition at line 25 of file hstore_gist.c.
#define SUMBIT | ( | val | ) |
Definition at line 77 of file hstore_gist.c.
typedef char* BITVECP |
Definition at line 31 of file hstore_gist.c.
|
static |
Definition at line 358 of file hstore_gist.c.
References a, b, and pg_cmp_s32().
Referenced by ghstore_picksplit().
|
static |
Definition at line 81 of file hstore_gist.c.
References buf, COMP_TRADITIONAL_CRC32, crc, FIN_TRADITIONAL_CRC32, INIT_TRADITIONAL_CRC32, and size.
Referenced by ghstore_compress(), and ghstore_consistent().
Definition at line 118 of file hstore_gist.c.
References ALLISTRUE, CALCGTSIZE, flag(), GETSIGN, palloc(), res, SET_VARSIZE, sign, and size.
Referenced by ghstore_compress(), ghstore_picksplit(), and ghstore_union().
Datum ghstore_compress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 148 of file hstore_gist.c.
References ARRPTR, crc32_sz(), DatumGetHStoreP, DatumGetPointer(), GET_SIGLEN, GETSIGN, ghstore_alloc(), gistentryinit, HASH, HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, i, ISALLTRUE, GISTENTRY::key, GISTENTRY::leafkey, LOOPBYTE, GISTENTRY::offset, GISTENTRY::page, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum(), GISTENTRY::rel, res, sign, STRPTR, and val.
Datum ghstore_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 509 of file hstore_gist.c.
References ARRPTR, crc, crc32_sz(), DatumGetPointer(), deconstruct_array_builtin(), elog, ERROR, GET_SIGLEN, GETBIT, GETSIGN, HASHVAL, HS_COUNT, HSTORE_KEY, HSTORE_KEYLEN, HSTORE_VAL, HSTORE_VALISNULL, HSTORE_VALLEN, HStoreContainsStrategyNumber, HStoreExistsAllStrategyNumber, HStoreExistsAnyStrategyNumber, HStoreExistsStrategyNumber, HStoreOldContainsStrategyNumber, i, ISALLTRUE, PG_GETARG_ARRAYTYPE_P, PG_GETARG_HSTORE_P, PG_GETARG_POINTER, PG_GETARG_TEXT_PP, PG_GETARG_UINT16, PG_RETURN_BOOL, res, sign, STRPTR, VARDATA, VARDATA_ANY, VARHDRSZ, VARSIZE, and VARSIZE_ANY_EXHDR.
Datum ghstore_decompress | ( | PG_FUNCTION_ARGS | ) |
Definition at line 213 of file hstore_gist.c.
References PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum ghstore_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 98 of file hstore_gist.c.
References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.
Datum ghstore_options | ( | PG_FUNCTION_ARGS | ) |
Definition at line 614 of file hstore_gist.c.
References add_local_int_reloption(), init_local_reloptions(), PG_GETARG_POINTER, PG_RETURN_VOID, SIGLEN_DEFAULT, and SIGLEN_MAX.
Datum ghstore_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 108 of file hstore_gist.c.
References ereport, errcode(), errmsg(), ERROR, and PG_RETURN_VOID.
Datum ghstore_penalty | ( | PG_FUNCTION_ARGS | ) |
Definition at line 337 of file hstore_gist.c.
References DatumGetPointer(), GET_SIGLEN, hemdist(), GISTENTRY::key, newval, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum ghstore_picksplit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 366 of file hstore_gist.c.
References comparecost(), SPLITCOST::cost, FirstOffsetNumber, GET_SIGLEN, GETENTRY, GETSIGN, ghstore_alloc(), hemdist(), i, ISALLTRUE, j, LOOPBYTE, GistEntryVector::n, OffsetNumberNext, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PointerGetDatum(), SPLITCOST::pos, qsort, GIST_SPLITVEC::spl_ldatum, GIST_SPLITVEC::spl_left, GIST_SPLITVEC::spl_nleft, GIST_SPLITVEC::spl_nright, GIST_SPLITVEC::spl_rdatum, GIST_SPLITVEC::spl_right, and WISH_F.
Datum ghstore_same | ( | PG_FUNCTION_ARGS | ) |
Definition at line 219 of file hstore_gist.c.
References a, b, GET_SIGLEN, GETSIGN, i, ISALLTRUE, LOOPBYTE, PG_GETARG_POINTER, and PG_RETURN_POINTER.
Datum ghstore_union | ( | PG_FUNCTION_ARGS | ) |
Definition at line 310 of file hstore_gist.c.
References ALLISTRUE, CALCGTSIZE, GISTTYPE::flag, GET_SIGLEN, GETENTRY, GETSIGN, ghstore_alloc(), i, len, GistEntryVector::n, PG_GETARG_POINTER, PG_RETURN_POINTER, SET_VARSIZE, size, unionkey(), and VARSIZE.
Definition at line 281 of file hstore_gist.c.
References a, b, GETSIGN, hemdistsign(), ISALLTRUE, SIGLENBIT, and sizebitvec().
Referenced by ghstore_penalty(), and ghstore_picksplit().
PG_FUNCTION_INFO_V1 | ( | ghstore_compress | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_consistent | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_decompress | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_in | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_options | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_out | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_penalty | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_picksplit | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_same | ) |
PG_FUNCTION_INFO_V1 | ( | ghstore_union | ) |