/* ** The GiST Consistent method for boxes ** Should return false if for all data items x below entry, ** the predicate x op query == FALSE, where op is the oper ** corresponding to strategy in the pg_amop table. */ Datum g_cube_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); NDBOX *query = PG_GETARG_NDBOX(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); /* Oid subtype = PG_GETARG_OID(3); */ bool *recheck = (bool *) PG_GETARG_POINTER(4); bool res; /* All cases served by this function are exact */ *recheck = false; /* * if entry is not leaf, use g_cube_internal_consistent, else use * g_cube_leaf_consistent */ if (GIST_LEAF(entry)) res = g_cube_leaf_consistent(DatumGetNDBOX(entry->key), query, strategy); else res = g_cube_internal_consistent(DatumGetNDBOX(entry->key), query, strategy); PG_FREE_IF_COPY(query, 1); PG_RETURN_BOOL(res); }
/* ** The GiST Consistent method for boxes ** Should return false if for all data items x below entry, ** the predicate x op query == FALSE, where op is the oper ** corresponding to strategy in the pg_amop table. */ Datum g_cube_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); NDBOX *query = PG_GETARG_NDBOX(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); bool res; /* * if entry is not leaf, use g_cube_internal_consistent, else use * g_cube_leaf_consistent */ if (GIST_LEAF(entry)) res = g_cube_leaf_consistent( DatumGetNDBOX(entry->key), query, strategy); else res = g_cube_internal_consistent( DatumGetNDBOX(entry->key), query, strategy); PG_FREE_IF_COPY(query,1); PG_RETURN_BOOL(res); }