PostgreSQL Source Code  git master
spgquadtreeproc.c File Reference
#include "postgres.h"
#include "access/spgist.h"
#include "access/stratnum.h"
#include "access/spgist_private.h"
#include "catalog/pg_type.h"
#include "utils/builtins.h"
#include "utils/float.h"
#include "utils/geo_decls.h"
Include dependency graph for spgquadtreeproc.c:

Go to the source code of this file.

Macros

#define SPTEST(f, x, y)   DatumGetBool(DirectFunctionCall2(f, PointPGetDatum(x), PointPGetDatum(y)))
 

Functions

Datum spg_quad_config (PG_FUNCTION_ARGS)
 
static int16 getQuadrant (Point *centroid, Point *tst)
 
static BOXgetQuadrantArea (BOX *bbox, Point *centroid, int quadrant)
 
Datum spg_quad_choose (PG_FUNCTION_ARGS)
 
Datum spg_quad_picksplit (PG_FUNCTION_ARGS)
 
Datum spg_quad_inner_consistent (PG_FUNCTION_ARGS)
 
Datum spg_quad_leaf_consistent (PG_FUNCTION_ARGS)
 

Macro Definition Documentation

◆ SPTEST

#define SPTEST (   f,
  x,
 
)    DatumGetBool(DirectFunctionCall2(f, PointPGetDatum(x), PointPGetDatum(y)))

Function Documentation

◆ getQuadrant()

static int16 getQuadrant ( Point centroid,
Point tst 
)
static

Definition at line 56 of file spgquadtreeproc.c.

References elog, ERROR, point_above(), point_below(), point_horiz(), point_left(), point_right(), point_vert(), and SPTEST.

Referenced by spg_quad_choose(), spg_quad_inner_consistent(), and spg_quad_picksplit().

57 {
58  if ((SPTEST(point_above, tst, centroid) ||
59  SPTEST(point_horiz, tst, centroid)) &&
60  (SPTEST(point_right, tst, centroid) ||
61  SPTEST(point_vert, tst, centroid)))
62  return 1;
63 
64  if (SPTEST(point_below, tst, centroid) &&
65  (SPTEST(point_right, tst, centroid) ||
66  SPTEST(point_vert, tst, centroid)))
67  return 2;
68 
69  if ((SPTEST(point_below, tst, centroid) ||
70  SPTEST(point_horiz, tst, centroid)) &&
71  SPTEST(point_left, tst, centroid))
72  return 3;
73 
74  if (SPTEST(point_above, tst, centroid) &&
75  SPTEST(point_left, tst, centroid))
76  return 4;
77 
78  elog(ERROR, "getQuadrant: impossible case");
79  return 0;
80 }
Datum point_below(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1886
Datum point_right(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1868
#define ERROR
Definition: elog.h:43
Datum point_left(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1859
#define SPTEST(f, x, y)
Datum point_vert(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1895
Datum point_horiz(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1904
#define elog(elevel,...)
Definition: elog.h:226
Datum point_above(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1877

◆ getQuadrantArea()

static BOX* getQuadrantArea ( BOX bbox,
Point centroid,
int  quadrant 
)
static

Definition at line 84 of file spgquadtreeproc.c.

References BOX::high, BOX::low, palloc(), Point::x, and Point::y.

Referenced by spg_quad_inner_consistent().

85 {
86  BOX *result = (BOX *) palloc(sizeof(BOX));
87 
88  switch (quadrant)
89  {
90  case 1:
91  result->high = bbox->high;
92  result->low = *centroid;
93  break;
94  case 2:
95  result->high.x = bbox->high.x;
96  result->high.y = centroid->y;
97  result->low.x = centroid->x;
98  result->low.y = bbox->low.y;
99  break;
100  case 3:
101  result->high = *centroid;
102  result->low = bbox->low;
103  break;
104  case 4:
105  result->high.x = centroid->x;
106  result->high.y = bbox->high.y;
107  result->low.x = bbox->low.x;
108  result->low.y = centroid->y;
109  break;
110  }
111 
112  return result;
113 }
Definition: geo_decls.h:99
float8 x
Definition: geo_decls.h:57
Point low
Definition: geo_decls.h:101
float8 y
Definition: geo_decls.h:57
Point high
Definition: geo_decls.h:101
void * palloc(Size size)
Definition: mcxt.c:949

◆ spg_quad_choose()

Datum spg_quad_choose ( PG_FUNCTION_ARGS  )

Definition at line 116 of file spgquadtreeproc.c.

References spgChooseIn::allTheSame, arg, Assert, spgChooseIn::datum, DatumGetPointP, getQuadrant(), spgChooseIn::hasPrefix, spgChooseOut::matchNode, spgChooseIn::nNodes, PG_GETARG_POINTER, PG_RETURN_VOID, PointPGetDatum, spgChooseIn::prefixDatum, spgChooseOut::result, spgChooseOut::resultType, spgMatchNode, Point::x, x_cmp(), Point::y, and y_cmp().

117 {
120  Point *inPoint = DatumGetPointP(in->datum),
121  *centroid;
122 
123  if (in->allTheSame)
124  {
125  out->resultType = spgMatchNode;
126  /* nodeN will be set by core */
127  out->result.matchNode.levelAdd = 0;
128  out->result.matchNode.restDatum = PointPGetDatum(inPoint);
129  PG_RETURN_VOID();
130  }
131 
132  Assert(in->hasPrefix);
133  centroid = DatumGetPointP(in->prefixDatum);
134 
135  Assert(in->nNodes == 4);
136 
137  out->resultType = spgMatchNode;
138  out->result.matchNode.nodeN = getQuadrant(centroid, inPoint) - 1;
139  out->result.matchNode.levelAdd = 0;
140  out->result.matchNode.restDatum = PointPGetDatum(inPoint);
141 
142  PG_RETURN_VOID();
143 }
Datum datum
Definition: spgist.h:58
bool hasPrefix
Definition: spgist.h:64
struct spgChooseOut::@48::@49 matchNode
Datum prefixDatum
Definition: spgist.h:65
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:271
static int16 getQuadrant(Point *centroid, Point *tst)
int nNodes
Definition: spgist.h:66
spgChooseResultType resultType
Definition: spgist.h:79
#define PG_RETURN_VOID()
Definition: fmgr.h:339
#define Assert(condition)
Definition: c.h:732
#define DatumGetPointP(X)
Definition: geo_decls.h:134
union spgChooseOut::@48 result
bool allTheSame
Definition: spgist.h:63
#define PointPGetDatum(X)
Definition: geo_decls.h:135

◆ spg_quad_config()

Datum spg_quad_config ( PG_FUNCTION_ARGS  )

Definition at line 28 of file spgquadtreeproc.c.

References spgConfigOut::canReturnData, spgConfigOut::labelType, spgConfigOut::longValuesOK, PG_GETARG_POINTER, PG_RETURN_VOID, and spgConfigOut::prefixType.

29 {
30  /* spgConfigIn *cfgin = (spgConfigIn *) PG_GETARG_POINTER(0); */
32 
33  cfg->prefixType = POINTOID;
34  cfg->labelType = VOIDOID; /* we don't need node labels */
35  cfg->canReturnData = true;
36  cfg->longValuesOK = false;
38 }
bool canReturnData
Definition: spgist.h:49
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:271
bool longValuesOK
Definition: spgist.h:50
Oid prefixType
Definition: spgist.h:46
#define PG_RETURN_VOID()
Definition: fmgr.h:339
Oid labelType
Definition: spgist.h:47

◆ spg_quad_inner_consistent()

Datum spg_quad_inner_consistent ( PG_FUNCTION_ARGS  )

Definition at line 228 of file spgquadtreeproc.c.

References spgInnerConsistentIn::allTheSame, Assert, box_contain_pt(), box_copy(), BoxPGetDatum, DatumGetBool, DatumGetBoxP, DatumGetPointP, DirectFunctionCall2, spgInnerConsistentOut::distances, elog, ERROR, get_float8_infinity(), getQuadrant(), getQuadrantArea(), spgInnerConsistentIn::hasPrefix, BOX::high, i, spgInnerConsistentIn::level, spgInnerConsistentOut::levelAdds, BOX::low, MemoryContextSwitchTo(), spgInnerConsistentIn::nkeys, spgInnerConsistentIn::nNodes, spgInnerConsistentOut::nNodes, spgInnerConsistentOut::nodeNumbers, spgInnerConsistentIn::norderbys, spgInnerConsistentIn::orderbys, palloc(), PG_GETARG_POINTER, PG_RETURN_VOID, point_above(), point_below(), point_left(), point_right(), PointerGetDatum, spgInnerConsistentIn::prefixDatum, RTAboveStrategyNumber, RTBelowStrategyNumber, RTContainedByStrategyNumber, RTLeftStrategyNumber, RTRightStrategyNumber, RTSameStrategyNumber, spgInnerConsistentIn::scankeys, ScanKeyData::sk_argument, ScanKeyData::sk_strategy, spg_key_orderbys_distances(), SPTEST, spgInnerConsistentIn::traversalMemoryContext, spgInnerConsistentIn::traversalValue, spgInnerConsistentOut::traversalValues, Point::x, and Point::y.

229 {
232  Point *centroid;
233  BOX infbbox;
234  BOX *bbox = NULL;
235  int which;
236  int i;
237 
238  Assert(in->hasPrefix);
239  centroid = DatumGetPointP(in->prefixDatum);
240 
241  /*
242  * When ordering scan keys are specified, we've to calculate distance for
243  * them. In order to do that, we need calculate bounding boxes for all
244  * children nodes. Calculation of those bounding boxes on non-zero level
245  * require knowledge of bounding box of upper node. So, we save bounding
246  * boxes to traversalValues.
247  */
248  if (in->norderbys > 0)
249  {
250  out->distances = (double **) palloc(sizeof(double *) * in->nNodes);
251  out->traversalValues = (void **) palloc(sizeof(void *) * in->nNodes);
252 
253  if (in->level == 0)
254  {
255  double inf = get_float8_infinity();
256 
257  infbbox.high.x = inf;
258  infbbox.high.y = inf;
259  infbbox.low.x = -inf;
260  infbbox.low.y = -inf;
261  bbox = &infbbox;
262  }
263  else
264  {
265  bbox = in->traversalValue;
266  Assert(bbox);
267  }
268  }
269 
270  if (in->allTheSame)
271  {
272  /* Report that all nodes should be visited */
273  out->nNodes = in->nNodes;
274  out->nodeNumbers = (int *) palloc(sizeof(int) * in->nNodes);
275  for (i = 0; i < in->nNodes; i++)
276  {
277  out->nodeNumbers[i] = i;
278 
279  if (in->norderbys > 0)
280  {
282 
283  /* Use parent quadrant box as traversalValue */
284  BOX *quadrant = box_copy(bbox);
285 
286  MemoryContextSwitchTo(oldCtx);
287 
288  out->traversalValues[i] = quadrant;
289  out->distances[i] = spg_key_orderbys_distances(BoxPGetDatum(quadrant), false,
290  in->orderbys, in->norderbys);
291  }
292  }
293  PG_RETURN_VOID();
294  }
295 
296  Assert(in->nNodes == 4);
297 
298  /* "which" is a bitmask of quadrants that satisfy all constraints */
299  which = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4);
300 
301  for (i = 0; i < in->nkeys; i++)
302  {
303  Point *query = DatumGetPointP(in->scankeys[i].sk_argument);
304  BOX *boxQuery;
305 
306  switch (in->scankeys[i].sk_strategy)
307  {
309  if (SPTEST(point_right, centroid, query))
310  which &= (1 << 3) | (1 << 4);
311  break;
313  if (SPTEST(point_left, centroid, query))
314  which &= (1 << 1) | (1 << 2);
315  break;
317  which &= (1 << getQuadrant(centroid, query));
318  break;
320  if (SPTEST(point_above, centroid, query))
321  which &= (1 << 2) | (1 << 3);
322  break;
324  if (SPTEST(point_below, centroid, query))
325  which &= (1 << 1) | (1 << 4);
326  break;
328 
329  /*
330  * For this operator, the query is a box not a point. We
331  * cheat to the extent of assuming that DatumGetPointP won't
332  * do anything that would be bad for a pointer-to-box.
333  */
334  boxQuery = DatumGetBoxP(in->scankeys[i].sk_argument);
335 
337  PointerGetDatum(boxQuery),
338  PointerGetDatum(centroid))))
339  {
340  /* centroid is in box, so all quadrants are OK */
341  }
342  else
343  {
344  /* identify quadrant(s) containing all corners of box */
345  Point p;
346  int r = 0;
347 
348  p = boxQuery->low;
349  r |= 1 << getQuadrant(centroid, &p);
350  p.y = boxQuery->high.y;
351  r |= 1 << getQuadrant(centroid, &p);
352  p = boxQuery->high;
353  r |= 1 << getQuadrant(centroid, &p);
354  p.x = boxQuery->low.x;
355  r |= 1 << getQuadrant(centroid, &p);
356 
357  which &= r;
358  }
359  break;
360  default:
361  elog(ERROR, "unrecognized strategy number: %d",
362  in->scankeys[i].sk_strategy);
363  break;
364  }
365 
366  if (which == 0)
367  break; /* no need to consider remaining conditions */
368  }
369 
370  out->levelAdds = palloc(sizeof(int) * 4);
371  for (i = 0; i < 4; ++i)
372  out->levelAdds[i] = 1;
373 
374  /* We must descend into the quadrant(s) identified by which */
375  out->nodeNumbers = (int *) palloc(sizeof(int) * 4);
376  out->nNodes = 0;
377 
378  for (i = 1; i <= 4; i++)
379  {
380  if (which & (1 << i))
381  {
382  out->nodeNumbers[out->nNodes] = i - 1;
383 
384  if (in->norderbys > 0)
385  {
387  BOX *quadrant = getQuadrantArea(bbox, centroid, i);
388 
389  MemoryContextSwitchTo(oldCtx);
390 
391  out->traversalValues[out->nNodes] = quadrant;
392 
393  out->distances[out->nNodes] = spg_key_orderbys_distances(BoxPGetDatum(quadrant), false,
394  in->orderbys, in->norderbys);
395  }
396 
397  out->nNodes++;
398  }
399  }
400 
401  PG_RETURN_VOID();
402 }
static BOX * getQuadrantArea(BOX *bbox, Point *centroid, int quadrant)
Definition: geo_decls.h:99
static float8 get_float8_infinity(void)
Definition: float.h:90
float8 x
Definition: geo_decls.h:57
#define RTLeftStrategyNumber
Definition: stratnum.h:51
#define PointerGetDatum(X)
Definition: postgres.h:556
Datum box_contain_pt(PG_FUNCTION_ARGS)
Definition: geo_ops.c:3195
ScanKey orderbys
Definition: spgist.h:138
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
void * traversalValue
Definition: spgist.h:144
#define RTContainedByStrategyNumber
Definition: stratnum.h:58
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:271
#define RTBelowStrategyNumber
Definition: stratnum.h:60
Datum point_below(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1886
Datum point_right(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1868
MemoryContext traversalMemoryContext
Definition: spgist.h:145
#define ERROR
Definition: elog.h:43
StrategyNumber sk_strategy
Definition: skey.h:68
Datum point_left(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1859
#define SPTEST(f, x, y)
#define DatumGetBool(X)
Definition: postgres.h:393
#define RTSameStrategyNumber
Definition: stratnum.h:56
static int16 getQuadrant(Point *centroid, Point *tst)
void ** traversalValues
Definition: spgist.h:163
Point low
Definition: geo_decls.h:101
double ** distances
Definition: spgist.h:164
BOX * box_copy(BOX *orig)
Definition: spgproc.c:82
#define BoxPGetDatum(X)
Definition: geo_decls.h:157
#define PG_RETURN_VOID()
Definition: fmgr.h:339
#define RTAboveStrategyNumber
Definition: stratnum.h:61
#define Assert(condition)
Definition: c.h:732
float8 y
Definition: geo_decls.h:57
#define RTRightStrategyNumber
Definition: stratnum.h:55
#define DatumGetPointP(X)
Definition: geo_decls.h:134
ScanKey scankeys
Definition: spgist.h:137
#define DatumGetBoxP(X)
Definition: geo_decls.h:156
Point high
Definition: geo_decls.h:101
void * palloc(Size size)
Definition: mcxt.c:949
double * spg_key_orderbys_distances(Datum key, bool isLeaf, ScanKey orderbys, int norderbys)
Definition: spgproc.c:63
#define elog(elevel,...)
Definition: elog.h:226
int i
Datum point_above(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1877
Datum sk_argument
Definition: skey.h:72
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:619

◆ spg_quad_leaf_consistent()

Datum spg_quad_leaf_consistent ( PG_FUNCTION_ARGS  )

Definition at line 406 of file spgquadtreeproc.c.

References box_contain_pt(), DatumGetPointP, spgLeafConsistentOut::distances, elog, ERROR, i, spgLeafConsistentIn::leafDatum, spgLeafConsistentOut::leafValue, spgLeafConsistentIn::nkeys, spgLeafConsistentIn::norderbys, spgLeafConsistentIn::orderbys, PG_GETARG_POINTER, PG_RETURN_BOOL, point_above(), point_below(), point_eq(), point_left(), point_right(), spgLeafConsistentOut::recheck, RTAboveStrategyNumber, RTBelowStrategyNumber, RTContainedByStrategyNumber, RTLeftStrategyNumber, RTRightStrategyNumber, RTSameStrategyNumber, spgLeafConsistentIn::scankeys, ScanKeyData::sk_argument, ScanKeyData::sk_strategy, spg_key_orderbys_distances(), and SPTEST.

407 {
410  Point *datum = DatumGetPointP(in->leafDatum);
411  bool res;
412  int i;
413 
414  /* all tests are exact */
415  out->recheck = false;
416 
417  /* leafDatum is what it is... */
418  out->leafValue = in->leafDatum;
419 
420  /* Perform the required comparison(s) */
421  res = true;
422  for (i = 0; i < in->nkeys; i++)
423  {
424  Point *query = DatumGetPointP(in->scankeys[i].sk_argument);
425 
426  switch (in->scankeys[i].sk_strategy)
427  {
429  res = SPTEST(point_left, datum, query);
430  break;
432  res = SPTEST(point_right, datum, query);
433  break;
435  res = SPTEST(point_eq, datum, query);
436  break;
438  res = SPTEST(point_below, datum, query);
439  break;
441  res = SPTEST(point_above, datum, query);
442  break;
444 
445  /*
446  * For this operator, the query is a box not a point. We
447  * cheat to the extent of assuming that DatumGetPointP won't
448  * do anything that would be bad for a pointer-to-box.
449  */
450  res = SPTEST(box_contain_pt, query, datum);
451  break;
452  default:
453  elog(ERROR, "unrecognized strategy number: %d",
454  in->scankeys[i].sk_strategy);
455  break;
456  }
457 
458  if (!res)
459  break;
460  }
461 
462  if (res && in->norderbys > 0)
463  /* ok, it passes -> let's compute the distances */
465  in->orderbys, in->norderbys);
466 
467  PG_RETURN_BOOL(res);
468 }
#define RTLeftStrategyNumber
Definition: stratnum.h:51
Datum box_contain_pt(PG_FUNCTION_ARGS)
Definition: geo_ops.c:3195
#define RTContainedByStrategyNumber
Definition: stratnum.h:58
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:271
#define RTBelowStrategyNumber
Definition: stratnum.h:60
Datum point_below(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1886
Datum point_right(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1868
#define ERROR
Definition: elog.h:43
ScanKey orderbys
Definition: spgist.h:173
StrategyNumber sk_strategy
Definition: skey.h:68
ScanKey scankeys
Definition: spgist.h:172
Datum point_left(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1859
double * distances
Definition: spgist.h:191
#define SPTEST(f, x, y)
#define RTSameStrategyNumber
Definition: stratnum.h:56
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:349
#define RTAboveStrategyNumber
Definition: stratnum.h:61
#define RTRightStrategyNumber
Definition: stratnum.h:55
#define DatumGetPointP(X)
Definition: geo_decls.h:134
double * spg_key_orderbys_distances(Datum key, bool isLeaf, ScanKey orderbys, int norderbys)
Definition: spgproc.c:63
Datum point_eq(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1913
#define elog(elevel,...)
Definition: elog.h:226
int i
Datum point_above(PG_FUNCTION_ARGS)
Definition: geo_ops.c:1877
Datum sk_argument
Definition: skey.h:72

◆ spg_quad_picksplit()

Datum spg_quad_picksplit ( PG_FUNCTION_ARGS  )

Definition at line 170 of file spgquadtreeproc.c.

References DatumGetPointP, spgPickSplitIn::datums, getQuadrant(), spgPickSplitOut::hasPrefix, i, spgPickSplitOut::leafTupleDatums, spgPickSplitOut::mapTuplesToNodes, spgPickSplitOut::nNodes, spgPickSplitOut::nodeLabels, spgPickSplitIn::nTuples, palloc(), palloc0(), PG_GETARG_POINTER, PG_RETURN_VOID, PointPGetDatum, spgPickSplitOut::prefixDatum, qsort, Point::x, x_cmp(), Point::y, and y_cmp().

171 {
174  int i;
175  Point *centroid;
176 
177 #ifdef USE_MEDIAN
178  /* Use the median values of x and y as the centroid point */
179  Point **sorted;
180 
181  sorted = palloc(sizeof(*sorted) * in->nTuples);
182  for (i = 0; i < in->nTuples; i++)
183  sorted[i] = DatumGetPointP(in->datums[i]);
184 
185  centroid = palloc(sizeof(*centroid));
186 
187  qsort(sorted, in->nTuples, sizeof(*sorted), x_cmp);
188  centroid->x = sorted[in->nTuples >> 1]->x;
189  qsort(sorted, in->nTuples, sizeof(*sorted), y_cmp);
190  centroid->y = sorted[in->nTuples >> 1]->y;
191 #else
192  /* Use the average values of x and y as the centroid point */
193  centroid = palloc0(sizeof(*centroid));
194 
195  for (i = 0; i < in->nTuples; i++)
196  {
197  centroid->x += DatumGetPointP(in->datums[i])->x;
198  centroid->y += DatumGetPointP(in->datums[i])->y;
199  }
200 
201  centroid->x /= in->nTuples;
202  centroid->y /= in->nTuples;
203 #endif
204 
205  out->hasPrefix = true;
206  out->prefixDatum = PointPGetDatum(centroid);
207 
208  out->nNodes = 4;
209  out->nodeLabels = NULL; /* we don't need node labels */
210 
211  out->mapTuplesToNodes = palloc(sizeof(int) * in->nTuples);
212  out->leafTupleDatums = palloc(sizeof(Datum) * in->nTuples);
213 
214  for (i = 0; i < in->nTuples; i++)
215  {
216  Point *p = DatumGetPointP(in->datums[i]);
217  int quadrant = getQuadrant(centroid, p) - 1;
218 
219  out->leafTupleDatums[i] = PointPGetDatum(p);
220  out->mapTuplesToNodes[i] = quadrant;
221  }
222 
223  PG_RETURN_VOID();
224 }
float8 x
Definition: geo_decls.h:57
Datum * leafTupleDatums
Definition: spgist.h:129
Datum * datums
Definition: spgist.h:116
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:271
Datum * nodeLabels
Definition: spgist.h:126
static int16 getQuadrant(Point *centroid, Point *tst)
static int x_cmp(const void *a, const void *b)
Definition: spgkdtreeproc.c:85
void * palloc0(Size size)
Definition: mcxt.c:980
uintptr_t Datum
Definition: postgres.h:367
#define PG_RETURN_VOID()
Definition: fmgr.h:339
float8 y
Definition: geo_decls.h:57
#define DatumGetPointP(X)
Definition: geo_decls.h:134
bool hasPrefix
Definition: spgist.h:122
void * palloc(Size size)
Definition: mcxt.c:949
int i
int * mapTuplesToNodes
Definition: spgist.h:128
Datum prefixDatum
Definition: spgist.h:123
#define qsort(a, b, c, d)
Definition: port.h:492
#define PointPGetDatum(X)
Definition: geo_decls.h:135
static int y_cmp(const void *a, const void *b)
Definition: spgkdtreeproc.c:96