PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized_gist_consistent_2d()

Datum gserialized_gist_consistent_2d ( PG_FUNCTION_ARGS  )

Definition at line 1054 of file gserialized_gist_2d.c.

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

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: