MCPcopy Create free account
hub / github.com/apache/cloudberry / GetNSItemByRangeTablePosn

Function GetNSItemByRangeTablePosn

src/backend/parser/parse_relation.c:498–519  ·  view source on GitHub ↗

* Given an RT index and nesting depth, find the corresponding * ParseNamespaceItem (there must be one). */

Source from the content-addressed store, hash-verified

496 * ParseNamespaceItem (there must be one).
497 */
498ParseNamespaceItem *
499GetNSItemByRangeTablePosn(ParseState *pstate,
500 int varno,
501 int sublevels_up)
502{
503 ListCell *lc;
504
505 while (sublevels_up-- > 0)
506 {
507 pstate = pstate->parentParseState;
508 Assert(pstate != NULL);
509 }
510 foreach(lc, pstate->p_namespace)
511 {
512 ParseNamespaceItem *nsitem = (ParseNamespaceItem *) lfirst(lc);
513
514 if (nsitem->p_rtindex == varno)
515 return nsitem;
516 }
517 elog(ERROR, "nsitem not found (internal error)");
518 return NULL; /* keep compiler quiet */
519}
520
521/*
522 * Given an RT index and nesting depth, find the corresponding RTE.

Callers 3

coerce_record_to_complexFunction · 0.85
ParseComplexProjectionFunction · 0.85
ExpandRowReferenceFunction · 0.85

Calls 1

foreachFunction · 0.50

Tested by

no test coverage detected