PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/spgist.h"
#include "catalog/pg_type.h"
#include "common/int.h"
#include "mb/pg_wchar.h"
#include "utils/datum.h"
#include "utils/fmgrprotos.h"
#include "utils/pg_locale.h"
#include "utils/varlena.h"
#include "varatt.h"
Go to the source code of this file.
Data Structures | |
struct | spgNodePtr |
Macros | |
#define | SPGIST_MAX_PREFIX_LENGTH Max((int) (BLCKSZ - 258 * 16 - 100), 32) |
#define | SPG_STRATEGY_ADDITION (10) |
#define | SPG_IS_COLLATION_AWARE_STRATEGY(s) |
Typedefs | |
typedef struct spgNodePtr | spgNodePtr |
Functions | |
Datum | spg_text_config (PG_FUNCTION_ARGS) |
static Datum | formTextDatum (const char *data, int datalen) |
static int | commonPrefix (const char *a, const char *b, int lena, int lenb) |
static bool | searchChar (Datum *nodeLabels, int nNodes, int16 c, int *i) |
Datum | spg_text_choose (PG_FUNCTION_ARGS) |
static int | cmpNodePtr (const void *a, const void *b) |
Datum | spg_text_picksplit (PG_FUNCTION_ARGS) |
Datum | spg_text_inner_consistent (PG_FUNCTION_ARGS) |
Datum | spg_text_leaf_consistent (PG_FUNCTION_ARGS) |
#define SPG_IS_COLLATION_AWARE_STRATEGY | ( | s | ) |
Definition at line 83 of file spgtextproc.c.
#define SPG_STRATEGY_ADDITION (10) |
Definition at line 82 of file spgtextproc.c.
#define SPGIST_MAX_PREFIX_LENGTH Max((int) (BLCKSZ - 258 * 16 - 100), 32) |
Definition at line 70 of file spgtextproc.c.
typedef struct spgNodePtr spgNodePtr |
|
static |
Definition at line 324 of file spgtextproc.c.
References a, b, spgNodePtr::c, and pg_cmp_s16().
Referenced by spg_text_picksplit().
|
static |
|
static |
Definition at line 113 of file spgtextproc.c.
References data, palloc(), PointerGetDatum(), SET_VARSIZE, SET_VARSIZE_SHORT, VARATT_SHORT_MAX, VARHDRSZ, and VARHDRSZ_SHORT.
Referenced by spg_text_choose(), and spg_text_picksplit().
Definition at line 158 of file spgtextproc.c.
References DatumGetInt16(), and i.
Referenced by spg_text_choose().
Datum spg_text_choose | ( | PG_FUNCTION_ARGS | ) |
Definition at line 184 of file spgtextproc.c.
References spgChooseOut::addNode, spgChooseIn::allTheSame, commonPrefix(), spgChooseIn::datum, DatumGetTextPP, formTextDatum(), spgChooseIn::hasPrefix, i, Int16GetDatum(), spgChooseIn::level, spgChooseOut::matchNode, spgChooseIn::nNodes, spgChooseIn::nodeLabels, palloc(), PG_GETARG_POINTER, PG_RETURN_VOID, spgChooseIn::prefixDatum, spgChooseOut::result, spgChooseOut::resultType, searchChar(), spgAddNode, spgMatchNode, spgSplitTuple, spgChooseOut::splitTuple, VARDATA_ANY, and VARSIZE_ANY_EXHDR.
Datum spg_text_config | ( | PG_FUNCTION_ARGS | ) |
Definition at line 96 of file spgtextproc.c.
References spgConfigOut::canReturnData, spgConfigOut::labelType, spgConfigOut::longValuesOK, PG_GETARG_POINTER, PG_RETURN_VOID, and spgConfigOut::prefixType.
Datum spg_text_inner_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 426 of file spgtextproc.c.
References Assert, BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, pg_locale_struct::collate_is_c, datumCopy(), DatumGetInt16(), DatumGetPointer(), DatumGetTextPP, elog, ERROR, spgInnerConsistentIn::hasPrefix, i, j, spgInnerConsistentIn::level, spgInnerConsistentOut::levelAdds, Min, spgInnerConsistentIn::nkeys, spgInnerConsistentIn::nNodes, spgInnerConsistentOut::nNodes, spgInnerConsistentIn::nodeLabels, spgInnerConsistentOut::nodeNumbers, palloc(), PG_GET_COLLATION, PG_GETARG_POINTER, pg_newlocale_from_collation(), PG_RETURN_VOID, PointerGetDatum(), spgInnerConsistentIn::prefixDatum, spgInnerConsistentIn::reconstructedValue, spgInnerConsistentOut::reconstructedValues, res, RTPrefixStrategyNumber, spgInnerConsistentIn::scankeys, SET_VARSIZE, ScanKeyData::sk_argument, ScanKeyData::sk_strategy, SPG_IS_COLLATION_AWARE_STRATEGY, SPG_STRATEGY_ADDITION, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.
Datum spg_text_leaf_consistent | ( | PG_FUNCTION_ARGS | ) |
Definition at line 574 of file spgtextproc.c.
References Assert, BTEqualStrategyNumber, BTGreaterEqualStrategyNumber, BTGreaterStrategyNumber, BTLessEqualStrategyNumber, BTLessStrategyNumber, DatumGetBool(), DatumGetPointer(), DatumGetTextPP, DirectFunctionCall2Coll(), elog, ERROR, j, spgLeafConsistentIn::leafDatum, spgLeafConsistentOut::leafValue, spgLeafConsistentIn::level, Min, spgLeafConsistentIn::nkeys, palloc(), PG_GET_COLLATION, PG_GETARG_POINTER, PG_RETURN_BOOL, pg_verifymbstr(), PointerGetDatum(), spgLeafConsistentOut::recheck, spgLeafConsistentIn::reconstructedValue, res, RTPrefixStrategyNumber, spgLeafConsistentIn::scankeys, SET_VARSIZE, ScanKeyData::sk_argument, ScanKeyData::sk_strategy, SPG_IS_COLLATION_AWARE_STRATEGY, SPG_STRATEGY_ADDITION, text_starts_with(), VARDATA, VARDATA_ANY, VARHDRSZ, VARSIZE_ANY_EXHDR, and varstr_cmp().
Datum spg_text_picksplit | ( | PG_FUNCTION_ARGS | ) |
Definition at line 333 of file spgtextproc.c.
References spgNodePtr::c, cmpNodePtr(), commonPrefix(), spgNodePtr::d, DatumGetTextPP, spgPickSplitIn::datums, formTextDatum(), spgPickSplitOut::hasPrefix, i, spgNodePtr::i, Int16GetDatum(), spgPickSplitOut::leafTupleDatums, spgPickSplitOut::mapTuplesToNodes, Min, spgPickSplitOut::nNodes, spgPickSplitOut::nodeLabels, spgPickSplitIn::nTuples, palloc(), PG_GETARG_POINTER, PG_RETURN_VOID, spgPickSplitOut::prefixDatum, qsort, SPGIST_MAX_PREFIX_LENGTH, VARDATA_ANY, and VARSIZE_ANY_EXHDR.