PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ gserialized_gist_consistent_2d()

Datum gserialized_gist_consistent_2d ( PG_FUNCTION_ARGS  )

Definition at line 1038 of file gserialized_gist_2d.c.

1039 {
1040  GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
1041  StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
1042  bool result;
1043  BOX2DF query_gbox_index;
1044 
1045  /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
1046  rather than being supplied as part of the operator class definition */
1047  bool *recheck = (bool *) PG_GETARG_POINTER(4);
1048 
1049  /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1050  out during index scans. For cases when the geometries are large, rechecking
1051  can make things twice as slow. */
1052  *recheck = false;
1053 
1054  POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1055 
1056  /* Quick sanity check on query argument. */
1057  if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1058  {
1059  POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1060  PG_RETURN_BOOL(false); /* NULL query! This is screwy! */
1061  }
1062 
1063  /* Quick sanity check on entry key. */
1064  if ( DatumGetPointer(entry->key) == NULL )
1065  {
1066  POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1067  PG_RETURN_BOOL(false); /* NULL entry! */
1068  }
1069 
1070  /* Null box should never make this far. */
1071  if ( gserialized_datum_get_box2df_p(PG_GETARG_DATUM(1), &query_gbox_index) == LW_FAILURE )
1072  {
1073  POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1074  PG_RETURN_BOOL(false);
1075  }
1076 
1077  /* Treat leaf node tests different from internal nodes */
1078  if (GIST_LEAF(entry))
1079  {
1081  (BOX2DF*)DatumGetPointer(entry->key),
1082  &query_gbox_index, strategy);
1083  }
1084  else
1085  {
1087  (BOX2DF*)DatumGetPointer(entry->key),
1088  &query_gbox_index, strategy);
1089  }
1090 
1091  PG_RETURN_BOOL(result);
1092 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
static bool gserialized_gist_consistent_internal_2d(BOX2DF *key, BOX2DF *query, StrategyNumber strategy)
int gserialized_datum_get_box2df_p(Datum gsdatum, BOX2DF *box2df)
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(), LW_FAILURE, and result.

Here is the call graph for this function: