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

◆ gserialized_gist_consistent_2d()

Datum gserialized_gist_consistent_2d ( PG_FUNCTION_ARGS  )

Definition at line 1073 of file gserialized_gist_2d.c.

1074{
1075 GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
1076 StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
1077 bool result;
1078 BOX2DF query_gbox_index;
1079
1080 /* PostgreSQL requires the RECHECK flag to be set here,
1081 rather than being supplied as part of the operator class definition */
1082 bool *recheck = (bool *) PG_GETARG_POINTER(4);
1083
1084 /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1085 out during index scans. For cases when the geometries are large, rechecking
1086 can make things twice as slow. */
1087 *recheck = false;
1088
1089 POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1090
1091 /* Quick sanity check on query argument. */
1092 if ( DatumGetPointer(PG_GETARG_DATUM(1)) == NULL )
1093 {
1094 POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1095 PG_RETURN_BOOL(false); /* NULL query! This is screwy! */
1096 }
1097
1098 /* Quick sanity check on entry key. */
1099 if ( DatumGetPointer(entry->key) == NULL )
1100 {
1101 POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1102 PG_RETURN_BOOL(false); /* NULL entry! */
1103 }
1104
1105 /* Null box should never make this far. */
1106 if ( gserialized_datum_get_box2df_p(PG_GETARG_DATUM(1), &query_gbox_index) == LW_FAILURE )
1107 {
1108 POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1109 PG_RETURN_BOOL(false);
1110 }
1111
1112 /* Treat leaf node tests different from internal nodes */
1113 if (GIST_LEAF(entry))
1114 {
1116 (BOX2DF*)DatumGetPointer(entry->key),
1117 &query_gbox_index, strategy);
1118 }
1119 else
1120 {
1122 (BOX2DF*)DatumGetPointer(entry->key),
1123 &query_gbox_index, strategy);
1124 }
1125
1126 PG_RETURN_BOOL(result);
1127}
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: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: