PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_gist_consistent()

Datum gserialized_gist_consistent ( PG_FUNCTION_ARGS  )

Definition at line 1187 of file gserialized_gist_nd.c.

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

Referenced by gserialized_gist_consistent_internal().

1188 {
1189  GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
1190  StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
1191  bool result;
1192  char gidxmem[GIDX_MAX_SIZE];
1193  GIDX *query_gbox_index = (GIDX*)gidxmem;
1194 
1195  /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
1196  rather than being supplied as part of the operator class definition */
1197  bool *recheck = (bool *) PG_GETARG_POINTER(4);
1198 
1199  /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1200  out during index scans. For cases when the geometries are large, rechecking
1201  can make things twice as slow. */
1202  *recheck = false;
1203 
1204  POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1205 
1206  /* Quick sanity check on query argument. */
1207  if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1208  {
1209  POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1210  PG_RETURN_BOOL(FALSE); /* NULL query! This is screwy! */
1211  }
1212 
1213  /* Quick sanity check on entry key. */
1214  if ( DatumGetPointer(entry->key) == NULL )
1215  {
1216  POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1217  PG_RETURN_BOOL(FALSE); /* NULL entry! */
1218  }
1219 
1220  /* Null box should never make this far. */
1221  if ( gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), query_gbox_index) == LW_FAILURE )
1222  {
1223  POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1224  PG_RETURN_BOOL(FALSE);
1225  }
1226 
1227  /* Treat leaf node tests different from internal nodes */
1228  if (GIST_LEAF(entry))
1229  {
1231  (GIDX*)DatumGetPointer(entry->key),
1232  query_gbox_index, strategy);
1233  }
1234  else
1235  {
1237  (GIDX*)DatumGetPointer(entry->key),
1238  query_gbox_index, strategy);
1239  }
1240 
1241  PG_RETURN_BOOL(result);
1242 }
static bool gserialized_gist_consistent_leaf(GIDX *key, GIDX *query, StrategyNumber strategy)
#define LW_FAILURE
Definition: liblwgeom.h:78
#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:
Here is the caller graph for this function: