PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_gist_consistent_2d()

Datum gserialized_gist_consistent_2d ( PG_FUNCTION_ARGS  )

Definition at line 1193 of file gserialized_gist_2d.c.

1194 {
1195  GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
1196  StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
1197  bool result;
1198  BOX2DF query_gbox_index;
1199 
1200  /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
1201  rather than being supplied as part of the operator class definition */
1202  bool *recheck = (bool *) PG_GETARG_POINTER(4);
1203 
1204  /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1205  out during index scans. For cases when the geometries are large, rechecking
1206  can make things twice as slow. */
1207  *recheck = false;
1208 
1209  POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1210 
1211  /* Quick sanity check on query argument. */
1212  if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1213  {
1214  POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1215  PG_RETURN_BOOL(false); /* NULL query! This is screwy! */
1216  }
1217 
1218  /* Quick sanity check on entry key. */
1219  if ( DatumGetPointer(entry->key) == NULL )
1220  {
1221  POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1222  PG_RETURN_BOOL(false); /* NULL entry! */
1223  }
1224 
1225  /* Null box should never make this far. */
1226  if ( gserialized_datum_get_box2df_p(PG_GETARG_DATUM(1), &query_gbox_index) == LW_FAILURE )
1227  {
1228  POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1229  PG_RETURN_BOOL(false);
1230  }
1231 
1232  /* Treat leaf node tests different from internal nodes */
1233  if (GIST_LEAF(entry))
1234  {
1236  (BOX2DF*)DatumGetPointer(entry->key),
1237  &query_gbox_index, strategy);
1238  }
1239  else
1240  {
1242  (BOX2DF*)DatumGetPointer(entry->key),
1243  &query_gbox_index, strategy);
1244  }
1245 
1246  PG_RETURN_BOOL(result);
1247 }
static bool gserialized_gist_consistent_internal_2d(BOX2DF *key, BOX2DF *query, StrategyNumber strategy)
int gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df)
Peak into a GSERIALIZED datum to find the bounding box.
static bool gserialized_gist_consistent_leaf_2d(BOX2DF *key, BOX2DF *query, StrategyNumber strategy)
#define LW_FAILURE
Definition: liblwgeom.h:79

References gserialized_datum_get_box2df_p(), gserialized_gist_consistent_internal_2d(), gserialized_gist_consistent_leaf_2d(), and LW_FAILURE.

Here is the call graph for this function: