** The GiST Consistent method for _intments ** 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. */
| 43 | ** corresponding to strategy in the pg_amop table. |
| 44 | */ |
| 45 | Datum |
| 46 | g_int_consistent(PG_FUNCTION_ARGS) |
| 47 | { |
| 48 | GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); |
| 49 | ArrayType *query = PG_GETARG_ARRAYTYPE_P_COPY(1); |
| 50 | StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); |
| 51 | |
| 52 | /* Oid subtype = PG_GETARG_OID(3); */ |
| 53 | bool *recheck = (bool *) PG_GETARG_POINTER(4); |
| 54 | bool retval; |
| 55 | |
| 56 | /* this is exact except for RTSameStrategyNumber */ |
| 57 | *recheck = (strategy == RTSameStrategyNumber); |
| 58 | |
| 59 | if (strategy == BooleanSearchStrategy) |
| 60 | { |
| 61 | retval = execconsistent((QUERYTYPE *) query, |
| 62 | (ArrayType *) DatumGetPointer(entry->key), |
| 63 | GIST_LEAF(entry)); |
| 64 | |
| 65 | pfree(query); |
| 66 | PG_RETURN_BOOL(retval); |
| 67 | } |
| 68 | |
| 69 | /* sort query for fast search, key is already sorted */ |
| 70 | CHECKARRVALID(query); |
| 71 | PREPAREARR(query); |
| 72 | |
| 73 | switch (strategy) |
| 74 | { |
| 75 | case RTOverlapStrategyNumber: |
| 76 | retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key), |
| 77 | query); |
| 78 | break; |
| 79 | case RTSameStrategyNumber: |
| 80 | if (GIST_LEAF(entry)) |
| 81 | DirectFunctionCall3(g_int_same, |
| 82 | entry->key, |
| 83 | PointerGetDatum(query), |
| 84 | PointerGetDatum(&retval)); |
| 85 | else |
| 86 | retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key), |
| 87 | query); |
| 88 | break; |
| 89 | case RTContainsStrategyNumber: |
| 90 | case RTOldContainsStrategyNumber: |
| 91 | retval = inner_int_contains((ArrayType *) DatumGetPointer(entry->key), |
| 92 | query); |
| 93 | break; |
| 94 | case RTContainedByStrategyNumber: |
| 95 | case RTOldContainedByStrategyNumber: |
| 96 | |
| 97 | /* |
| 98 | * This code is unreachable as of intarray 1.4, because the <@ |
| 99 | * operator has been removed from the opclass. We keep it for now |
| 100 | * to support older versions of the SQL definitions. |
| 101 | */ |
| 102 | if (GIST_LEAF(entry)) |
nothing calls this directly
no test coverage detected