PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_gist_consistent()

Datum gserialized_gist_consistent ( PG_FUNCTION_ARGS  )

Definition at line 1254 of file gserialized_gist_nd.c.

1255 {
1256  GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
1257  StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
1258  bool result;
1259  char gidxmem[GIDX_MAX_SIZE];
1260  GIDX *query_gbox_index = (GIDX*)gidxmem;
1261 
1262  /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
1263  rather than being supplied as part of the operator class definition */
1264  bool *recheck = (bool *) PG_GETARG_POINTER(4);
1265 
1266  /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1267  out during index scans. For cases when the geometries are large, rechecking
1268  can make things twice as slow. */
1269  *recheck = false;
1270 
1271  POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1272 
1273  /* Quick sanity check on query argument. */
1274  if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1275  {
1276  POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1277  PG_RETURN_BOOL(false); /* NULL query! This is screwy! */
1278  }
1279 
1280  /* Quick sanity check on entry key. */
1281  if ( DatumGetPointer(entry->key) == NULL )
1282  {
1283  POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1284  PG_RETURN_BOOL(false); /* NULL entry! */
1285  }
1286 
1287  /* Null box should never make this far. */
1288  if ( gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), query_gbox_index) == LW_FAILURE )
1289  {
1290  POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1291  PG_RETURN_BOOL(false);
1292  }
1293 
1294  /* Treat leaf node tests different from internal nodes */
1295  if (GIST_LEAF(entry))
1296  {
1298  (GIDX*)DatumGetPointer(entry->key),
1299  query_gbox_index, strategy);
1300  }
1301  else
1302  {
1304  (GIDX*)DatumGetPointer(entry->key),
1305  query_gbox_index, strategy);
1306  }
1307 
1308  PG_RETURN_BOOL(result);
1309 }
static bool gserialized_gist_consistent_internal(GIDX *key, GIDX *query, StrategyNumber strategy)
static bool gserialized_gist_consistent_leaf(GIDX *key, GIDX *query, StrategyNumber strategy)
#define LW_FAILURE
Definition: liblwgeom.h:79

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

Here is the call graph for this function: