diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2004-05-28 10:43:32 +0000 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2004-05-28 10:43:32 +0000 |
commit | 42d069886f38687839388c615af608706508b557 (patch) | |
tree | 0409615407a17d22e2511ac14745277467853453 /contrib/btree_gist/btree_common.c | |
parent | 1a321f26d88e5c64bccba9d36920aede1e201729 (diff) |
New version. Add support for int2, int8, float4, float8, timestamp with/without time zone, time with/without time zone, date, interval, oid, money and macaddr, char, varchar/text, bytea, numeric, bit, varbit, inet/cidr types for GiST
Diffstat (limited to 'contrib/btree_gist/btree_common.c')
-rw-r--r-- | contrib/btree_gist/btree_common.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/contrib/btree_gist/btree_common.c b/contrib/btree_gist/btree_common.c deleted file mode 100644 index b2353bf57be..00000000000 --- a/contrib/btree_gist/btree_common.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "btree_gist.h" - -PG_FUNCTION_INFO_V1(btree_decompress); -Datum btree_decompress(PG_FUNCTION_ARGS); - -/* -** GiST DeCompress methods -** do not do anything. -*/ -Datum -btree_decompress(PG_FUNCTION_ARGS) -{ - PG_RETURN_POINTER(PG_GETARG_POINTER(0)); -} - - -/************************************************** - * Common btree-function (for all ops) - **************************************************/ - -/* -** The GiST PickSplit method -*/ -extern GIST_SPLITVEC * -btree_picksplit(GistEntryVector *entryvec, GIST_SPLITVEC *v, BINARY_UNION bu, CMPFUNC cmp) -{ - OffsetNumber i; - RIX *array; - OffsetNumber maxoff; - int nbytes; - - 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; - v->spl_ldatum = PointerGetDatum(0); - v->spl_rdatum = PointerGetDatum(0); - array = (RIX *) palloc(sizeof(RIX) * (maxoff + 1)); - - /* copy the data into RIXes, and sort the RIXes */ - for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) - { - array[i].index = i; - array[i].r = (char *) DatumGetPointer((entryvec->vector[i].key)); - } - qsort((void *) &array[FirstOffsetNumber], maxoff - FirstOffsetNumber + 1, - sizeof(RIX), cmp); - - for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i)) - { - if (i <= (maxoff - FirstOffsetNumber + 1) / 2) - { - v->spl_left[v->spl_nleft] = array[i].index; - v->spl_nleft++; - (*bu) (&v->spl_ldatum, array[i].r); - } - else - { - v->spl_right[v->spl_nright] = array[i].index; - v->spl_nright++; - (*bu) (&v->spl_rdatum, array[i].r); - } - } - pfree(array); - - return (v); -} |