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

◆ gserialized_gist_consistent()

Datum gserialized_gist_consistent ( PG_FUNCTION_ARGS  )

Definition at line 1082 of file gserialized_gist_nd.c.

1083{
1084 GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
1085 StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
1086 bool result;
1087 char gidxmem[GIDX_MAX_SIZE];
1088 GIDX *query_gbox_index = (GIDX *)gidxmem;
1089
1090 /* PostgreSQL requires the RECHECK flag to be set here,
1091 rather than being supplied as part of the operator class definition */
1092 bool *recheck = (bool *)PG_GETARG_POINTER(4);
1093
1094 /* We set recheck to false to avoid repeatedly pulling every "possibly matched" geometry
1095 out during index scans. For cases when the geometries are large, rechecking
1096 can make things twice as slow. */
1097 *recheck = false;
1098
1099 POSTGIS_DEBUG(4, "[GIST] 'consistent' function called");
1100
1101 /* Quick sanity check on query argument. */
1102 if (!DatumGetPointer(PG_GETARG_DATUM(1)))
1103 {
1104 POSTGIS_DEBUG(4, "[GIST] null query pointer (!?!), returning false");
1105 PG_RETURN_BOOL(false); /* NULL query! This is screwy! */
1106 }
1107
1108 /* Quick sanity check on entry key. */
1109 if (!DatumGetPointer(entry->key))
1110 {
1111 POSTGIS_DEBUG(4, "[GIST] null index entry, returning false");
1112 PG_RETURN_BOOL(false); /* NULL entry! */
1113 }
1114
1115 /* Null box should never make this far. */
1116 if (gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), query_gbox_index) == LW_FAILURE)
1117 {
1118 POSTGIS_DEBUG(4, "[GIST] null query_gbox_index!");
1119 PG_RETURN_BOOL(false);
1120 }
1121
1122 /* Treat leaf node tests different from internal nodes */
1123 if (GIST_LEAF(entry))
1124 {
1125 result =
1126 gserialized_gist_consistent_leaf((GIDX *)PG_DETOAST_DATUM(entry->key), query_gbox_index, strategy);
1127 }
1128 else
1129 {
1131 (GIDX *)PG_DETOAST_DATUM(entry->key), query_gbox_index, strategy);
1132 }
1133
1134 PG_RETURN_BOOL(result);
1135}
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition cu_print.c:267
static bool gserialized_gist_consistent_internal(GIDX *key, GIDX *query, StrategyNumber strategy)
static bool gserialized_gist_consistent_leaf(GIDX *key, GIDX *query, StrategyNumber strategy)
#define LW_FAILURE
Definition liblwgeom.h:96

References gserialized_gist_consistent_internal(), gserialized_gist_consistent_leaf(), LW_FAILURE, and result.

Here is the call graph for this function: