PostGIS  2.2.7dev-r@@SVN_REVISION@@
Datum gserialized_gist_consistent ( PG_FUNCTION_ARGS  )

Definition at line 998 of file gserialized_gist_nd.c.

References FALSE, gserialized_gist_consistent_internal(), gserialized_gist_consistent_leaf(), and LW_FAILURE.

999 {
1000  GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
1001  StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
1002  bool result;
1003  char gidxmem[GIDX_MAX_SIZE];
1004  GIDX *query_gbox_index = (GIDX*)gidxmem;
1005 
1006  /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
1007  rather than being supplied as part of the operator class definition */
1008  bool *recheck = (bool *) PG_GETARG_POINTER(4);
1009 
1010  /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1011  out during index scans. For cases when the geometries are large, rechecking
1012  can make things twice as slow. */
1013  *recheck = false;
1014 
1015  POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1016 
1017  /* Quick sanity check on query argument. */
1018  if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1019  {
1020  POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1021  PG_RETURN_BOOL(FALSE); /* NULL query! This is screwy! */
1022  }
1023 
1024  /* Quick sanity check on entry key. */
1025  if ( DatumGetPointer(entry->key) == NULL )
1026  {
1027  POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1028  PG_RETURN_BOOL(FALSE); /* NULL entry! */
1029  }
1030 
1031  /* Null box should never make this far. */
1032  if ( gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), query_gbox_index) == LW_FAILURE )
1033  {
1034  POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1035  PG_RETURN_BOOL(FALSE);
1036  }
1037 
1038  /* Treat leaf node tests different from internal nodes */
1039  if (GIST_LEAF(entry))
1040  {
1042  (GIDX*)DatumGetPointer(entry->key),
1043  query_gbox_index, strategy);
1044  }
1045  else
1046  {
1048  (GIDX*)DatumGetPointer(entry->key),
1049  query_gbox_index, strategy);
1050  }
1051 
1052  PG_RETURN_BOOL(result);
1053 }
static bool gserialized_gist_consistent_leaf(GIDX *key, GIDX *query, StrategyNumber strategy)
#define LW_FAILURE
Definition: liblwgeom.h:64
#define FALSE
Definition: dbfopen.c:168
static bool gserialized_gist_consistent_internal(GIDX *key, GIDX *query, StrategyNumber strategy)

Here is the call graph for this function: