* Given an RT index and nesting depth, find the corresponding RTE. * (Note that the RTE need not be in the query's namespace.) */
| 523 | * (Note that the RTE need not be in the query's namespace.) |
| 524 | */ |
| 525 | RangeTblEntry * |
| 526 | GetRTEByRangeTablePosn(ParseState *pstate, |
| 527 | int varno, |
| 528 | int sublevels_up) |
| 529 | { |
| 530 | while (sublevels_up-- > 0) |
| 531 | { |
| 532 | pstate = pstate->parentParseState; |
| 533 | Assert(pstate != NULL); |
| 534 | } |
| 535 | Assert(varno > 0 && varno <= list_length(pstate->p_rtable)); |
| 536 | return rt_fetch(varno, pstate->p_rtable); |
| 537 | } |
| 538 | |
| 539 | /* |
| 540 | * Fetch the CTE for a CTE-reference RTE. |
no test coverage detected