PostgreSQL Source Code  git master
hstore_gist.c
Go to the documentation of this file.
1 /*
2  * contrib/hstore/hstore_gist.c
3  */
4 #include "postgres.h"
5 
6 #include "access/gist.h"
7 #include "access/stratnum.h"
8 #include "catalog/pg_type.h"
9 #include "hstore.h"
10 #include "utils/pg_crc.h"
11 
12 /* bigint defines */
13 #define BITBYTE 8
14 #define SIGLENINT 4 /* >122 => key will toast, so very slow!!! */
15 #define SIGLEN ( sizeof(int)*SIGLENINT )
16 #define SIGLENBIT (SIGLEN*BITBYTE)
17 
18 typedef char BITVEC[SIGLEN];
19 typedef char *BITVECP;
20 
21 #define LOOPBYTE \
22  for(i=0;i<SIGLEN;i++)
23 
24 #define LOOPBIT \
25  for(i=0;i<SIGLENBIT;i++)
26 
27 /* beware of multiple evaluation of arguments to these macros! */
28 #define GETBYTE(x,i) ( *( (BITVECP)(x) + (int)( (i) / BITBYTE ) ) )
29 #define GETBITBYTE(x,i) ( (*((char*)(x)) >> (i)) & 0x01 )
30 #define CLRBIT(x,i) GETBYTE(x,i) &= ~( 0x01 << ( (i) % BITBYTE ) )
31 #define SETBIT(x,i) GETBYTE(x,i) |= ( 0x01 << ( (i) % BITBYTE ) )
32 #define GETBIT(x,i) ( (GETBYTE(x,i) >> ( (i) % BITBYTE )) & 0x01 )
33 #define HASHVAL(val) (((unsigned int)(val)) % SIGLENBIT)
34 #define HASH(sign, val) SETBIT((sign), HASHVAL(val))
35 
36 typedef struct
37 {
38  int32 vl_len_; /* varlena header (do not touch directly!) */
40  char data[FLEXIBLE_ARRAY_MEMBER];
41 } GISTTYPE;
42 
43 #define ALLISTRUE 0x04
44 
45 #define ISALLTRUE(x) ( ((GISTTYPE*)x)->flag & ALLISTRUE )
46 
47 #define GTHDRSIZE (VARHDRSZ + sizeof(int32))
48 #define CALCGTSIZE(flag) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : SIGLEN) )
49 
50 #define GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) )
51 
52 #define SUMBIT(val) ( \
53  GETBITBYTE((val),0) + \
54  GETBITBYTE((val),1) + \
55  GETBITBYTE((val),2) + \
56  GETBITBYTE((val),3) + \
57  GETBITBYTE((val),4) + \
58  GETBITBYTE((val),5) + \
59  GETBITBYTE((val),6) + \
60  GETBITBYTE((val),7) \
61 )
62 
63 #define GETENTRY(vec,pos) ((GISTTYPE *) DatumGetPointer((vec)->vector[(pos)].key))
64 
65 #define WISH_F(a,b,c) (double)( -(double)(((a)-(b))*((a)-(b))*((a)-(b)))*(c) )
66 
67 /* shorthand for calculating CRC-32 of a single chunk of data. */
68 static pg_crc32
69 crc32_sz(char *buf, int size)
70 {
71  pg_crc32 crc;
72 
74  COMP_TRADITIONAL_CRC32(crc, buf, size);
76 
77  return crc;
78 }
79 
80 
83 
84 
85 Datum
87 {
88  elog(ERROR, "Not implemented");
89  PG_RETURN_DATUM(0);
90 }
91 
92 Datum
94 {
95  elog(ERROR, "Not implemented");
96  PG_RETURN_DATUM(0);
97 }
98 
106 
107 Datum
109 {
110  GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
111  GISTENTRY *retval = entry;
112 
113  if (entry->leafkey)
114  {
115  GISTTYPE *res = (GISTTYPE *) palloc0(CALCGTSIZE(0));
116  HStore *val = DatumGetHStoreP(entry->key);
117  HEntry *hsent = ARRPTR(val);
118  char *ptr = STRPTR(val);
119  int count = HS_COUNT(val);
120  int i;
121 
122  SET_VARSIZE(res, CALCGTSIZE(0));
123 
124  for (i = 0; i < count; ++i)
125  {
126  int h;
127 
128  h = crc32_sz((char *) HSTORE_KEY(hsent, ptr, i),
129  HSTORE_KEYLEN(hsent, i));
130  HASH(GETSIGN(res), h);
131  if (!HSTORE_VALISNULL(hsent, i))
132  {
133  h = crc32_sz((char *) HSTORE_VAL(hsent, ptr, i),
134  HSTORE_VALLEN(hsent, i));
135  HASH(GETSIGN(res), h);
136  }
137  }
138 
139  retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
140  gistentryinit(*retval, PointerGetDatum(res),
141  entry->rel, entry->page,
142  entry->offset,
143  false);
144  }
145  else if (!ISALLTRUE(DatumGetPointer(entry->key)))
146  {
147  int32 i;
148  GISTTYPE *res;
150 
151  LOOPBYTE
152  {
153  if ((sign[i] & 0xff) != 0xff)
154  PG_RETURN_POINTER(retval);
155  }
156 
157  res = (GISTTYPE *) palloc(CALCGTSIZE(ALLISTRUE));
159  res->flag = ALLISTRUE;
160 
161  retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
162  gistentryinit(*retval, PointerGetDatum(res),
163  entry->rel, entry->page,
164  entry->offset,
165  false);
166  }
167 
168  PG_RETURN_POINTER(retval);
169 }
170 
171 /*
172  * Since type ghstore isn't toastable (and doesn't need to be),
173  * this function can be a no-op.
174  */
175 Datum
177 {
179 }
180 
181 Datum
183 {
184  GISTTYPE *a = (GISTTYPE *) PG_GETARG_POINTER(0);
185  GISTTYPE *b = (GISTTYPE *) PG_GETARG_POINTER(1);
186  bool *result = (bool *) PG_GETARG_POINTER(2);
187 
188  if (ISALLTRUE(a) && ISALLTRUE(b))
189  *result = true;
190  else if (ISALLTRUE(a))
191  *result = false;
192  else if (ISALLTRUE(b))
193  *result = false;
194  else
195  {
196  int32 i;
197  BITVECP sa = GETSIGN(a),
198  sb = GETSIGN(b);
199 
200  *result = true;
201  LOOPBYTE
202  {
203  if (sa[i] != sb[i])
204  {
205  *result = false;
206  break;
207  }
208  }
209  }
210  PG_RETURN_POINTER(result);
211 }
212 
213 static int32
215 {
216  int32 size = 0,
217  i;
218 
219  LOOPBYTE
220  {
221  size += SUMBIT(sign);
222  sign = (BITVECP) (((char *) sign) + 1);
223  }
224  return size;
225 }
226 
227 static int
229 {
230  int i,
231  dist = 0;
232 
233  LOOPBIT
234  {
235  if (GETBIT(a, i) != GETBIT(b, i))
236  dist++;
237  }
238  return dist;
239 }
240 
241 static int
243 {
244  if (ISALLTRUE(a))
245  {
246  if (ISALLTRUE(b))
247  return 0;
248  else
249  return SIGLENBIT - sizebitvec(GETSIGN(b));
250  }
251  else if (ISALLTRUE(b))
252  return SIGLENBIT - sizebitvec(GETSIGN(a));
253 
254  return hemdistsign(GETSIGN(a), GETSIGN(b));
255 }
256 
257 static int32
259 {
260  int32 i;
261  BITVECP sadd = GETSIGN(add);
262 
263  if (ISALLTRUE(add))
264  return 1;
265  LOOPBYTE
266  sbase[i] |= sadd[i];
267  return 0;
268 }
269 
270 Datum
272 {
274  int32 len = entryvec->n;
275 
276  int *size = (int *) PG_GETARG_POINTER(1);
277  BITVEC base;
278  int32 i;
279  int32 flag = 0;
280  GISTTYPE *result;
281 
282  MemSet((void *) base, 0, sizeof(BITVEC));
283  for (i = 0; i < len; i++)
284  {
285  if (unionkey(base, GETENTRY(entryvec, i)))
286  {
287  flag = ALLISTRUE;
288  break;
289  }
290  }
291 
292  len = CALCGTSIZE(flag);
293  result = (GISTTYPE *) palloc(len);
294  SET_VARSIZE(result, len);
295  result->flag = flag;
296  if (!ISALLTRUE(result))
297  memcpy((void *) GETSIGN(result), (void *) base, sizeof(BITVEC));
298  *size = len;
299 
300  PG_RETURN_POINTER(result);
301 }
302 
303 Datum
305 {
306  GISTENTRY *origentry = (GISTENTRY *) PG_GETARG_POINTER(0); /* always ISSIGNKEY */
307  GISTENTRY *newentry = (GISTENTRY *) PG_GETARG_POINTER(1);
308  float *penalty = (float *) PG_GETARG_POINTER(2);
309  GISTTYPE *origval = (GISTTYPE *) DatumGetPointer(origentry->key);
310  GISTTYPE *newval = (GISTTYPE *) DatumGetPointer(newentry->key);
311 
312  *penalty = hemdist(origval, newval);
313  PG_RETURN_POINTER(penalty);
314 }
315 
316 
317 typedef struct
318 {
321 } SPLITCOST;
322 
323 static int
324 comparecost(const void *a, const void *b)
325 {
326  return ((const SPLITCOST *) a)->cost - ((const SPLITCOST *) b)->cost;
327 }
328 
329 
330 Datum
332 {
334  OffsetNumber maxoff = entryvec->n - 2;
335 
337  OffsetNumber k,
338  j;
339  GISTTYPE *datum_l,
340  *datum_r;
341  BITVECP union_l,
342  union_r;
343  int32 size_alpha,
344  size_beta;
345  int32 size_waste,
346  waste = -1;
347  int32 nbytes;
348  OffsetNumber seed_1 = 0,
349  seed_2 = 0;
350  OffsetNumber *left,
351  *right;
352  BITVECP ptr;
353  int i;
354  SPLITCOST *costvector;
355  GISTTYPE *_k,
356  *_j;
357 
358  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
359  v->spl_left = (OffsetNumber *) palloc(nbytes);
360  v->spl_right = (OffsetNumber *) palloc(nbytes);
361 
362  for (k = FirstOffsetNumber; k < maxoff; k = OffsetNumberNext(k))
363  {
364  _k = GETENTRY(entryvec, k);
365  for (j = OffsetNumberNext(k); j <= maxoff; j = OffsetNumberNext(j))
366  {
367  size_waste = hemdist(_k, GETENTRY(entryvec, j));
368  if (size_waste > waste)
369  {
370  waste = size_waste;
371  seed_1 = k;
372  seed_2 = j;
373  }
374  }
375  }
376 
377  left = v->spl_left;
378  v->spl_nleft = 0;
379  right = v->spl_right;
380  v->spl_nright = 0;
381 
382  if (seed_1 == 0 || seed_2 == 0)
383  {
384  seed_1 = 1;
385  seed_2 = 2;
386  }
387 
388  /* form initial .. */
389  if (ISALLTRUE(GETENTRY(entryvec, seed_1)))
390  {
391  datum_l = (GISTTYPE *) palloc(GTHDRSIZE);
392  SET_VARSIZE(datum_l, GTHDRSIZE);
393  datum_l->flag = ALLISTRUE;
394  }
395  else
396  {
397  datum_l = (GISTTYPE *) palloc(GTHDRSIZE + SIGLEN);
398  SET_VARSIZE(datum_l, GTHDRSIZE + SIGLEN);
399  datum_l->flag = 0;
400  memcpy((void *) GETSIGN(datum_l), (void *) GETSIGN(GETENTRY(entryvec, seed_1)), sizeof(BITVEC))
401  ;
402  }
403  if (ISALLTRUE(GETENTRY(entryvec, seed_2)))
404  {
405  datum_r = (GISTTYPE *) palloc(GTHDRSIZE);
406  SET_VARSIZE(datum_r, GTHDRSIZE);
407  datum_r->flag = ALLISTRUE;
408  }
409  else
410  {
411  datum_r = (GISTTYPE *) palloc(GTHDRSIZE + SIGLEN);
412  SET_VARSIZE(datum_r, GTHDRSIZE + SIGLEN);
413  datum_r->flag = 0;
414  memcpy((void *) GETSIGN(datum_r), (void *) GETSIGN(GETENTRY(entryvec, seed_2)), sizeof(BITVEC));
415  }
416 
417  maxoff = OffsetNumberNext(maxoff);
418  /* sort before ... */
419  costvector = (SPLITCOST *) palloc(sizeof(SPLITCOST) * maxoff);
420  for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j))
421  {
422  costvector[j - 1].pos = j;
423  _j = GETENTRY(entryvec, j);
424  size_alpha = hemdist(datum_l, _j);
425  size_beta = hemdist(datum_r, _j);
426  costvector[j - 1].cost = abs(size_alpha - size_beta);
427  }
428  qsort((void *) costvector, maxoff, sizeof(SPLITCOST), comparecost);
429 
430  union_l = GETSIGN(datum_l);
431  union_r = GETSIGN(datum_r);
432 
433  for (k = 0; k < maxoff; k++)
434  {
435  j = costvector[k].pos;
436  if (j == seed_1)
437  {
438  *left++ = j;
439  v->spl_nleft++;
440  continue;
441  }
442  else if (j == seed_2)
443  {
444  *right++ = j;
445  v->spl_nright++;
446  continue;
447  }
448  _j = GETENTRY(entryvec, j);
449  size_alpha = hemdist(datum_l, _j);
450  size_beta = hemdist(datum_r, _j);
451 
452  if (size_alpha < size_beta + WISH_F(v->spl_nleft, v->spl_nright, 0.0001))
453  {
454  if (ISALLTRUE(datum_l) || ISALLTRUE(_j))
455  {
456  if (!ISALLTRUE(datum_l))
457  MemSet((void *) union_l, 0xff, sizeof(BITVEC));
458  }
459  else
460  {
461  ptr = GETSIGN(_j);
462  LOOPBYTE
463  union_l[i] |= ptr[i];
464  }
465  *left++ = j;
466  v->spl_nleft++;
467  }
468  else
469  {
470  if (ISALLTRUE(datum_r) || ISALLTRUE(_j))
471  {
472  if (!ISALLTRUE(datum_r))
473  MemSet((void *) union_r, 0xff, sizeof(BITVEC));
474  }
475  else
476  {
477  ptr = GETSIGN(_j);
478  LOOPBYTE
479  union_r[i] |= ptr[i];
480  }
481  *right++ = j;
482  v->spl_nright++;
483  }
484  }
485 
486  *right = *left = FirstOffsetNumber;
487 
488  v->spl_ldatum = PointerGetDatum(datum_l);
489  v->spl_rdatum = PointerGetDatum(datum_r);
490 
492 }
493 
494 
495 Datum
497 {
498  GISTTYPE *entry = (GISTTYPE *) DatumGetPointer(((GISTENTRY *) PG_GETARG_POINTER(0))->key);
500 
501  /* Oid subtype = PG_GETARG_OID(3); */
502  bool *recheck = (bool *) PG_GETARG_POINTER(4);
503  bool res = true;
504  BITVECP sign;
505 
506  /* All cases served by this function are inexact */
507  *recheck = true;
508 
509  if (ISALLTRUE(entry))
510  PG_RETURN_BOOL(true);
511 
512  sign = GETSIGN(entry);
513 
514  if (strategy == HStoreContainsStrategyNumber ||
516  {
517  HStore *query = PG_GETARG_HSTORE_P(1);
518  HEntry *qe = ARRPTR(query);
519  char *qv = STRPTR(query);
520  int count = HS_COUNT(query);
521  int i;
522 
523  for (i = 0; res && i < count; ++i)
524  {
525  int crc = crc32_sz((char *) HSTORE_KEY(qe, qv, i),
526  HSTORE_KEYLEN(qe, i));
527 
528  if (GETBIT(sign, HASHVAL(crc)))
529  {
530  if (!HSTORE_VALISNULL(qe, i))
531  {
532  crc = crc32_sz((char *) HSTORE_VAL(qe, qv, i),
533  HSTORE_VALLEN(qe, i));
534  if (!GETBIT(sign, HASHVAL(crc)))
535  res = false;
536  }
537  }
538  else
539  res = false;
540  }
541  }
542  else if (strategy == HStoreExistsStrategyNumber)
543  {
544  text *query = PG_GETARG_TEXT_PP(1);
545  int crc = crc32_sz(VARDATA_ANY(query), VARSIZE_ANY_EXHDR(query));
546 
547  res = (GETBIT(sign, HASHVAL(crc))) ? true : false;
548  }
549  else if (strategy == HStoreExistsAllStrategyNumber)
550  {
551  ArrayType *query = PG_GETARG_ARRAYTYPE_P(1);
552  Datum *key_datums;
553  bool *key_nulls;
554  int key_count;
555  int i;
556 
557  deconstruct_array(query,
558  TEXTOID, -1, false, 'i',
559  &key_datums, &key_nulls, &key_count);
560 
561  for (i = 0; res && i < key_count; ++i)
562  {
563  int crc;
564 
565  if (key_nulls[i])
566  continue;
567  crc = crc32_sz(VARDATA(key_datums[i]), VARSIZE(key_datums[i]) - VARHDRSZ);
568  if (!(GETBIT(sign, HASHVAL(crc))))
569  res = false;
570  }
571  }
572  else if (strategy == HStoreExistsAnyStrategyNumber)
573  {
574  ArrayType *query = PG_GETARG_ARRAYTYPE_P(1);
575  Datum *key_datums;
576  bool *key_nulls;
577  int key_count;
578  int i;
579 
580  deconstruct_array(query,
581  TEXTOID, -1, false, 'i',
582  &key_datums, &key_nulls, &key_count);
583 
584  res = false;
585 
586  for (i = 0; !res && i < key_count; ++i)
587  {
588  int crc;
589 
590  if (key_nulls[i])
591  continue;
592  crc = crc32_sz(VARDATA(key_datums[i]), VARSIZE(key_datums[i]) - VARHDRSZ);
593  if (GETBIT(sign, HASHVAL(crc)))
594  res = true;
595  }
596  }
597  else
598  elog(ERROR, "Unsupported strategy number: %d", strategy);
599 
600  PG_RETURN_BOOL(res);
601 }
Relation rel
Definition: gist.h:132
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:351
static int hemdist(GISTTYPE *a, GISTTYPE *b)
Definition: hstore_gist.c:242
OffsetNumber pos
Definition: hstore_gist.c:319
Definition: hstore.h:44
#define DatumGetHStoreP(d)
Definition: hstore.h:152
#define HStoreContainsStrategyNumber
Definition: hstore.h:180
#define SUMBIT(val)
Definition: hstore_gist.c:52
#define VARDATA_ANY(PTR)
Definition: postgres.h:348
#define VARDATA(PTR)
Definition: postgres.h:302
#define PG_GETARG_HSTORE_P(x)
Definition: hstore.h:154
#define VARSIZE(PTR)
Definition: postgres.h:303
#define GETSIGN(x)
Definition: hstore_gist.c:50
#define PointerGetDatum(X)
Definition: postgres.h:556
#define VARHDRSZ
Definition: c.h:556
#define SIGLENBIT
Definition: hstore_gist.c:16
#define HSTORE_KEYLEN(arr_, i_)
Definition: hstore.h:81
OffsetNumber * spl_left
Definition: gist.h:113
static int32 sizebitvec(BITVECP sign)
Definition: hstore_gist.c:214
Datum spl_rdatum
Definition: gist.h:120
#define LOOPBIT
Definition: hstore_gist.c:24
int32 n
Definition: gist.h:206
uint16 StrategyNumber
Definition: stratnum.h:22
#define ALLISTRUE
Definition: hstore_gist.c:43
#define MemSet(start, val, len)
Definition: c.h:956
#define HSTORE_VALLEN(arr_, i_)
Definition: hstore.h:82
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:271
#define HASH(sign, val)
Definition: hstore_gist.c:34
int32 flag
Definition: hstore_gist.c:39
int spl_nleft
Definition: gist.h:114
Datum ghstore_union(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:271
signed int int32
Definition: c.h:347
int32 cost
Definition: hstore_gist.c:320
#define PG_GETARG_TEXT_PP(n)
Definition: fmgr.h:303
#define COMP_TRADITIONAL_CRC32(crc, data, len)
Definition: pg_crc.h:48
uint16 OffsetNumber
Definition: off.h:24
Page page
Definition: gist.h:133
#define PG_GETARG_ARRAYTYPE_P(n)
Definition: array.h:251
#define HSTORE_VALISNULL(arr_, i_)
Definition: hstore.h:83
#define INIT_TRADITIONAL_CRC32(crc)
Definition: pg_crc.h:46
#define WISH_F(a, b, c)
Definition: hstore_gist.c:65
#define ERROR
Definition: elog.h:43
#define GTHDRSIZE
Definition: hstore_gist.c:47
int spl_nright
Definition: gist.h:119
char BITVEC[SIGLEN]
Definition: hstore_gist.c:18
#define HStoreExistsStrategyNumber
Definition: hstore.h:181
char sign
Definition: informix.c:688
Datum key
Definition: gist.h:131
#define HStoreExistsAllStrategyNumber
Definition: hstore.h:183
Datum ghstore_same(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:182
Datum ghstore_picksplit(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:331
static char * buf
Definition: pg_test_fsync.c:67
#define HS_COUNT(hsp_)
Definition: hstore.h:61
#define FirstOffsetNumber
Definition: off.h:27
char * flag(int b)
Definition: test-ctype.c:33
static int32 unionkey(BITVECP sbase, GISTTYPE *add)
Definition: hstore_gist.c:258
int32 vl_len_
Definition: hstore_gist.c:38
#define HASHVAL(val)
Definition: hstore_gist.c:33
#define FIN_TRADITIONAL_CRC32(crc)
Definition: pg_crc.h:47
#define HSTORE_KEY(arr_, str_, i_)
Definition: hstore.h:79
bool leafkey
Definition: gist.h:135
#define GETENTRY(vec, pos)
Definition: hstore_gist.c:63
void * palloc0(Size size)
Definition: mcxt.c:980
static pg_crc32 crc32_sz(char *buf, int size)
Definition: hstore_gist.c:69
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:349
uintptr_t Datum
Definition: postgres.h:367
#define PG_RETURN_DATUM(x)
Definition: fmgr.h:343
#define ISALLTRUE(x)
Definition: hstore_gist.c:45
Datum ghstore_decompress(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:176
#define CALCGTSIZE(flag)
Definition: hstore_gist.c:48
Datum spl_ldatum
Definition: gist.h:115
#define GETBIT(x, i)
Definition: hstore_gist.c:32
Datum ghstore_penalty(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:304
#define gistentryinit(e, k, r, pg, o, l)
Definition: gist.h:215
Datum ghstore_out(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:93
static int comparecost(const void *a, const void *b)
Definition: hstore_gist.c:324
#define OffsetNumberNext(offsetNumber)
Definition: off.h:52
#define newval
OffsetNumber * spl_right
Definition: gist.h:118
PG_FUNCTION_INFO_V1(ghstore_in)
Definition: hstore.h:18
Datum ghstore_consistent(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:496
#define PG_GETARG_UINT16(n)
Definition: fmgr.h:267
#define DatumGetPointer(X)
Definition: postgres.h:549
#define HSTORE_VAL(arr_, str_, i_)
Definition: hstore.h:80
void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
Definition: arrayfuncs.c:3461
#define VARSIZE_ANY_EXHDR(PTR)
Definition: postgres.h:341
void * palloc(Size size)
Definition: mcxt.c:949
Datum ghstore_compress(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:108
#define STRPTR(x)
Definition: hstore.h:76
#define LOOPBYTE
Definition: hstore_gist.c:21
#define HStoreExistsAnyStrategyNumber
Definition: hstore.h:182
#define elog(elevel,...)
Definition: elog.h:228
int i
#define SIGLEN
Definition: hstore_gist.c:15
Definition: c.h:550
#define PG_FUNCTION_ARGS
Definition: fmgr.h:188
#define SET_VARSIZE(PTR, len)
Definition: postgres.h:329
char * BITVECP
Definition: hstore_gist.c:19
uint32 pg_crc32
Definition: pg_crc.h:37
#define ARRPTR(x)
Definition: cube.c:24
#define qsort(a, b, c, d)
Definition: port.h:492
OffsetNumber offset
Definition: gist.h:134
Datum ghstore_in(PG_FUNCTION_ARGS)
Definition: hstore_gist.c:86
#define HStoreOldContainsStrategyNumber
Definition: hstore.h:184
long val
Definition: informix.c:684
static int hemdistsign(BITVECP a, BITVECP b)
Definition: hstore_gist.c:228