---------------------------------------------------------------- * ExecInitBitmapIndexScan * * Initializes the index scan's state information. * ---------------------------------------------------------------- */
| 248 | * ---------------------------------------------------------------- |
| 249 | */ |
| 250 | BitmapIndexScanState * |
| 251 | ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags) |
| 252 | { |
| 253 | BitmapIndexScanState *indexstate; |
| 254 | LOCKMODE lockmode; |
| 255 | |
| 256 | /* check for unsupported flags */ |
| 257 | Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK))); |
| 258 | |
| 259 | /* |
| 260 | * create state structure |
| 261 | */ |
| 262 | indexstate = makeNode(BitmapIndexScanState); |
| 263 | indexstate->ss.ps.plan = (Plan *) node; |
| 264 | indexstate->ss.ps.state = estate; |
| 265 | indexstate->ss.ps.ExecProcNode = ExecBitmapIndexScan; |
| 266 | |
| 267 | /* normally we don't make the result bitmap till runtime */ |
| 268 | indexstate->biss_result = NULL; |
| 269 | |
| 270 | /* |
| 271 | * We do not open or lock the base relation here. We assume that an |
| 272 | * ancestor BitmapHeapScan node is holding AccessShareLock (or better) on |
| 273 | * the heap relation throughout the execution of the plan tree. |
| 274 | */ |
| 275 | |
| 276 | indexstate->ss.ss_currentRelation = NULL; |
| 277 | indexstate->ss.ss_currentScanDesc = NULL; |
| 278 | |
| 279 | /* |
| 280 | * Miscellaneous initialization |
| 281 | * |
| 282 | * We do not need a standard exprcontext for this node, though we may |
| 283 | * decide below to create a runtime-key exprcontext |
| 284 | */ |
| 285 | |
| 286 | /* |
| 287 | * initialize child expressions |
| 288 | * |
| 289 | * We don't need to initialize targetlist or qual since neither are used. |
| 290 | * |
| 291 | * Note: we don't initialize all of the indexqual expression, only the |
| 292 | * sub-parts corresponding to runtime keys (see below). |
| 293 | */ |
| 294 | |
| 295 | /* |
| 296 | * If we are just doing EXPLAIN (ie, aren't going to run the plan), stop |
| 297 | * here. This allows an index-advisor plugin to EXPLAIN a plan containing |
| 298 | * references to nonexistent indexes. |
| 299 | */ |
| 300 | if (eflags & EXEC_FLAG_EXPLAIN_ONLY) |
| 301 | return indexstate; |
| 302 | |
| 303 | /* Open the index relation. */ |
| 304 | lockmode = exec_rt_fetch(node->scan.scanrelid, estate)->rellockmode; |
| 305 | indexstate->biss_RelationDesc = index_open(node->indexid, lockmode); |
| 306 | |
| 307 | /* |
no test coverage detected