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