---------------------------------------------------------------- * ExecReScanBitmapIndexScan(node) * * Recalculates the values of any scan keys whose value depends on * information known at runtime, then rescans the indexed relation. * ---------------------------------------------------------------- */
| 166 | * ---------------------------------------------------------------- |
| 167 | */ |
| 168 | void |
| 169 | ExecReScanBitmapIndexScan(BitmapIndexScanState *node) |
| 170 | { |
| 171 | ExprContext *econtext = node->biss_RuntimeContext; |
| 172 | |
| 173 | /* |
| 174 | * Reset the runtime-key context so we don't leak memory as each outer |
| 175 | * tuple is scanned. Note this assumes that we will recalculate *all* |
| 176 | * runtime keys on each call. |
| 177 | */ |
| 178 | if (econtext) |
| 179 | ResetExprContext(econtext); |
| 180 | |
| 181 | /* |
| 182 | * If we are doing runtime key calculations (ie, any of the index key |
| 183 | * values weren't simple Consts), compute the new key values. |
| 184 | * |
| 185 | * Array keys are also treated as runtime keys; note that if we return |
| 186 | * with biss_RuntimeKeysReady still false, then there is an empty array |
| 187 | * key so no index scan is needed. |
| 188 | */ |
| 189 | if (node->biss_NumRuntimeKeys != 0) |
| 190 | ExecIndexEvalRuntimeKeys(econtext, |
| 191 | node->biss_RuntimeKeys, |
| 192 | node->biss_NumRuntimeKeys); |
| 193 | if (node->biss_NumArrayKeys != 0) |
| 194 | node->biss_RuntimeKeysReady = |
| 195 | ExecIndexEvalArrayKeys(econtext, |
| 196 | node->biss_ArrayKeys, |
| 197 | node->biss_NumArrayKeys); |
| 198 | else |
| 199 | node->biss_RuntimeKeysReady = true; |
| 200 | |
| 201 | /* reset index scan */ |
| 202 | if (node->biss_RuntimeKeysReady) |
| 203 | index_rescan(node->biss_ScanDesc, |
| 204 | node->biss_ScanKeys, node->biss_NumScanKeys, |
| 205 | NULL, 0); |
| 206 | } |
| 207 | |
| 208 | /* ---------------------------------------------------------------- |
| 209 | * ExecEndBitmapIndexScan |
no test coverage detected