---------------------------------------------------------------- * ExecInitTableFuncscan * ---------------------------------------------------------------- */
| 107 | * ---------------------------------------------------------------- |
| 108 | */ |
| 109 | TableFuncScanState * |
| 110 | ExecInitTableFuncScan(TableFuncScan *node, EState *estate, int eflags) |
| 111 | { |
| 112 | TableFuncScanState *scanstate; |
| 113 | TableFunc *tf = node->tablefunc; |
| 114 | TupleDesc tupdesc; |
| 115 | int i; |
| 116 | |
| 117 | /* check for unsupported flags */ |
| 118 | Assert(!(eflags & EXEC_FLAG_MARK)); |
| 119 | |
| 120 | /* |
| 121 | * TableFuncscan should not have any children. |
| 122 | */ |
| 123 | Assert(outerPlan(node) == NULL); |
| 124 | Assert(innerPlan(node) == NULL); |
| 125 | |
| 126 | /* |
| 127 | * create new ScanState for node |
| 128 | */ |
| 129 | scanstate = makeNode(TableFuncScanState); |
| 130 | scanstate->ss.ps.plan = (Plan *) node; |
| 131 | scanstate->ss.ps.state = estate; |
| 132 | scanstate->ss.ps.ExecProcNode = ExecTableFuncScan; |
| 133 | |
| 134 | /* |
| 135 | * Miscellaneous initialization |
| 136 | * |
| 137 | * create expression context for node |
| 138 | */ |
| 139 | ExecAssignExprContext(estate, &scanstate->ss.ps); |
| 140 | |
| 141 | /* |
| 142 | * initialize source tuple type |
| 143 | */ |
| 144 | tupdesc = BuildDescFromLists(tf->colnames, |
| 145 | tf->coltypes, |
| 146 | tf->coltypmods, |
| 147 | tf->colcollations); |
| 148 | /* and the corresponding scan slot */ |
| 149 | ExecInitScanTupleSlot(estate, &scanstate->ss, tupdesc, |
| 150 | &TTSOpsMinimalTuple); |
| 151 | |
| 152 | /* |
| 153 | * Initialize result type and projection. |
| 154 | */ |
| 155 | ExecInitResultTypeTL(&scanstate->ss.ps); |
| 156 | ExecAssignScanProjectionInfo(&scanstate->ss); |
| 157 | |
| 158 | /* |
| 159 | * initialize child expressions |
| 160 | */ |
| 161 | scanstate->ss.ps.qual = |
| 162 | ExecInitQual(node->scan.plan.qual, &scanstate->ss.ps); |
| 163 | |
| 164 | /* Only XMLTABLE is supported currently */ |
| 165 | scanstate->routine = &XmlTableRoutine; |
| 166 |
no test coverage detected