| 922 | } |
| 923 | |
| 924 | IndexScanState * |
| 925 | ExecInitIndexScanForPartition(IndexScan *node, EState *estate, int eflags, |
| 926 | Relation currentRelation, Oid indexid) |
| 927 | { |
| 928 | IndexScanState *indexstate; |
| 929 | LOCKMODE lockmode; |
| 930 | |
| 931 | /* |
| 932 | * create state structure |
| 933 | */ |
| 934 | indexstate = makeNode(IndexScanState); |
| 935 | indexstate->ss.ps.plan = (Plan *) node; |
| 936 | indexstate->ss.ps.state = estate; |
| 937 | indexstate->ss.ps.ExecProcNode = ExecIndexScan; |
| 938 | |
| 939 | /* |
| 940 | * Miscellaneous initialization |
| 941 | * |
| 942 | * create expression context for node |
| 943 | */ |
| 944 | ExecAssignExprContext(estate, &indexstate->ss.ps); |
| 945 | |
| 946 | indexstate->ss.ss_currentRelation = currentRelation; |
| 947 | indexstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */ |
| 948 | |
| 949 | /* |
| 950 | * get the scan type from the relation descriptor. |
| 951 | */ |
| 952 | ExecInitScanTupleSlot(estate, &indexstate->ss, |
| 953 | RelationGetDescr(currentRelation), |
| 954 | table_slot_callbacks(currentRelation)); |
| 955 | |
| 956 | /* |
| 957 | * Initialize result type and projection. |
| 958 | */ |
| 959 | ExecInitResultTypeTL(&indexstate->ss.ps); |
| 960 | ExecAssignScanProjectionInfo(&indexstate->ss); |
| 961 | |
| 962 | /* |
| 963 | * initialize child expressions |
| 964 | * |
| 965 | * Note: we don't initialize all of the indexqual expression, only the |
| 966 | * sub-parts corresponding to runtime keys (see below). Likewise for |
| 967 | * indexorderby, if any. But the indexqualorig expression is always |
| 968 | * initialized even though it will only be used in some uncommon cases --- |
| 969 | * would be nice to improve that. (Problem is that any SubPlans present |
| 970 | * in the expression must be found now...) |
| 971 | */ |
| 972 | indexstate->ss.ps.qual = |
| 973 | ExecInitQual(node->scan.plan.qual, (PlanState *) indexstate); |
| 974 | indexstate->indexqualorig = |
| 975 | ExecInitQual(node->indexqualorig, (PlanState *) indexstate); |
| 976 | indexstate->indexorderbyorig = |
| 977 | ExecInitExprList(node->indexorderbyorig, (PlanState *) indexstate); |
| 978 | |
| 979 | /* |
| 980 | * If we are just doing EXPLAIN (ie, aren't going to run the plan), stop |
| 981 | * here. This allows an index-advisor plugin to EXPLAIN a plan containing |
no test coverage detected