1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Cleanup vectors of GISTENTRY and eliminate problem with 64-bit strict-aligned

boxes. Change interface to user-defined GiST support methods union and
picksplit. Now instead of bytea struct it used special GistEntryVector
structure.
This commit is contained in:
Teodor Sigaev
2004-03-30 15:45:33 +00:00
parent 8d9a28eeef
commit f2c064afcb
24 changed files with 185 additions and 195 deletions

View File

@ -138,22 +138,22 @@ g__BTREE_GIST_TYPE2___consistent(PG_FUNCTION_ARGS)
Datum
g__BTREE_GIST_TYPE2___union(PG_FUNCTION_ARGS)
{
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
GistEntryVector *entryvec = (GistEntryVector *) PG_GETARG_POINTER(0);
int i,
numranges;
__BTREE_GIST_TYPE__KEY *cur,
*out = palloc(sizeof(__BTREE_GIST_TYPE__KEY));
numranges = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
numranges = entryvec->n;
*(int *) PG_GETARG_POINTER(1) = sizeof(__BTREE_GIST_TYPE__KEY);
cur = (__BTREE_GIST_TYPE__KEY *) DatumGetPointer((((GISTENTRY *) (VARDATA(entryvec)))[0].key));
cur = (__BTREE_GIST_TYPE__KEY *) DatumGetPointer((entryvec->vector[0].key));
out->lower = cur->lower;
out->upper = cur->upper;
for (i = 1; i < numranges; i++)
{
cur = (__BTREE_GIST_TYPE__KEY *) DatumGetPointer((((GISTENTRY *) (VARDATA(entryvec)))[i].key));
cur = (__BTREE_GIST_TYPE__KEY *) DatumGetPointer((entryvec->vector[i].key));
if (out->lower > cur->lower)
out->lower = cur->lower;
if (out->upper < cur->upper)
@ -180,7 +180,7 @@ Datum
g__BTREE_GIST_TYPE2___picksplit(PG_FUNCTION_ARGS)
{
PG_RETURN_POINTER(btree_picksplit(
(bytea *) PG_GETARG_POINTER(0),
(GistEntryVector *) PG_GETARG_POINTER(0),
(GIST_SPLITVEC *) PG_GETARG_POINTER(1),
g__BTREE_GIST_TYPE2___binary_union,
__BTREE_GIST_TYPE2__key_cmp