PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ gserialized_gist_consistent_2d()

Datum gserialized_gist_consistent_2d ( PG_FUNCTION_ARGS  )

Definition at line 991 of file gserialized_gist_2d.c.

992{
993 GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
994 StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
995 bool result;
996 BOX2DF query_gbox_index;
997
998 /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
999 rather than being supplied as part of the operator class definition */
1000 bool *recheck = (bool *) PG_GETARG_POINTER(4);
1001
1002 /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1003 out during index scans. For cases when the geometries are large, rechecking
1004 can make things twice as slow. */
1005 *recheck = false;
1006
1007 POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1008
1009 /* Quick sanity check on query argument. */
1010 if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1011 {
1012 POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1013 PG_RETURN_BOOL(false); /* NULL query! This is screwy! */
1014 }
1015
1016 /* Quick sanity check on entry key. */
1017 if ( DatumGetPointer(entry->key) == NULL )
1018 {
1019 POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1020 PG_RETURN_BOOL(false); /* NULL entry! */
1021 }
1022
1023 /* Null box should never make this far. */
1024 if ( gserialized_datum_get_box2df_p(PG_GETARG_DATUM(1), &query_gbox_index) == LW_FAILURE )
1025 {
1026 POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1027 PG_RETURN_BOOL(false);
1028 }
1029
1030 /* Treat leaf node tests different from internal nodes */
1031 if (GIST_LEAF(entry))
1032 {
1034 (BOX2DF*)DatumGetPointer(entry->key),
1035 &query_gbox_index, strategy);
1036 }
1037 else
1038 {
1040 (BOX2DF*)DatumGetPointer(entry->key),
1041 &query_gbox_index, strategy);
1042 }
1043
1044 PG_RETURN_BOOL(result);
1045}
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:110

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: