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

Definition at line 704 of file gserialized_gist_nd.c.

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

705 {
706  GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
707  StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
708  bool result;
709  char gidxmem[GIDX_MAX_SIZE];
710  GIDX *query_gbox_index = (GIDX*)gidxmem;
711 
712  /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
713  rather than being supplied as part of the operator class definition */
714  bool *recheck = (bool *) PG_GETARG_POINTER(4);
715 
716  /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
717  out during index scans. For cases when the geometries are large, rechecking
718  can make things twice as slow. */
719  *recheck = false;
720 
721  POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
722 
723  /* Quick sanity check on query argument. */
724  if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
725  {
726  POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
727  PG_RETURN_BOOL(FALSE); /* NULL query! This is screwy! */
728  }
729 
730  /* Quick sanity check on entry key. */
731  if ( DatumGetPointer(entry->key) == NULL )
732  {
733  POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
734  PG_RETURN_BOOL(FALSE); /* NULL entry! */
735  }
736 
737  /* Null box should never make this far. */
738  if ( gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), query_gbox_index) == LW_FAILURE )
739  {
740  POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
741  PG_RETURN_BOOL(FALSE);
742  }
743 
744  /* Treat leaf node tests different from internal nodes */
745  if (GIST_LEAF(entry))
746  {
748  (GIDX*)DatumGetPointer(entry->key),
749  query_gbox_index, strategy);
750  }
751  else
752  {
754  (GIDX*)DatumGetPointer(entry->key),
755  query_gbox_index, strategy);
756  }
757 
758  PG_RETURN_BOOL(result);
759 }
char ** result
Definition: liblwgeom.h:218
static bool gserialized_gist_consistent_leaf(GIDX *key, GIDX *query, StrategyNumber strategy)
#define LW_FAILURE
Definition: liblwgeom.h:54
#define FALSE
Definition: dbfopen.c:169
static bool gserialized_gist_consistent_internal(GIDX *key, GIDX *query, StrategyNumber strategy)

Here is the call graph for this function: