| 107 | PG_FUNCTION_INFO_V1(ginint4_consistent); |
| 108 | |
| 109 | Datum |
| 110 | ginint4_consistent(PG_FUNCTION_ARGS) |
| 111 | { |
| 112 | bool *check = (bool *) PG_GETARG_POINTER(0); |
| 113 | StrategyNumber strategy = PG_GETARG_UINT16(1); |
| 114 | int32 nkeys = PG_GETARG_INT32(3); |
| 115 | |
| 116 | /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */ |
| 117 | bool *recheck = (bool *) PG_GETARG_POINTER(5); |
| 118 | bool res = false; |
| 119 | int32 i; |
| 120 | |
| 121 | switch (strategy) |
| 122 | { |
| 123 | case RTOverlapStrategyNumber: |
| 124 | /* result is not lossy */ |
| 125 | *recheck = false; |
| 126 | /* at least one element in check[] is true, so result = true */ |
| 127 | res = true; |
| 128 | break; |
| 129 | case RTContainedByStrategyNumber: |
| 130 | case RTOldContainedByStrategyNumber: |
| 131 | /* we will need recheck */ |
| 132 | *recheck = true; |
| 133 | /* at least one element in check[] is true, so result = true */ |
| 134 | res = true; |
| 135 | break; |
| 136 | case RTSameStrategyNumber: |
| 137 | /* we will need recheck */ |
| 138 | *recheck = true; |
| 139 | /* Must have all elements in check[] true */ |
| 140 | res = true; |
| 141 | for (i = 0; i < nkeys; i++) |
| 142 | { |
| 143 | if (!check[i]) |
| 144 | { |
| 145 | res = false; |
| 146 | break; |
| 147 | } |
| 148 | } |
| 149 | break; |
| 150 | case RTContainsStrategyNumber: |
| 151 | case RTOldContainsStrategyNumber: |
| 152 | /* result is not lossy */ |
| 153 | *recheck = false; |
| 154 | /* Must have all elements in check[] true */ |
| 155 | res = true; |
| 156 | for (i = 0; i < nkeys; i++) |
| 157 | { |
| 158 | if (!check[i]) |
| 159 | { |
| 160 | res = false; |
| 161 | break; |
| 162 | } |
| 163 | } |
| 164 | break; |
| 165 | case BooleanSearchStrategy: |
| 166 | { |
nothing calls this directly
no test coverage detected