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

Function CachedPlanGetTargetList

src/backend/utils/cache/plancache.c:1719–1743  ·  view source on GitHub ↗

* CachedPlanGetTargetList: return tlist, if any, describing plan's output * * The result is guaranteed up-to-date. However, it is local storage * within the cached plan, and may disappear next time the plan is updated. */

Source from the content-addressed store, hash-verified

1717 * within the cached plan, and may disappear next time the plan is updated.
1718 */
1719List *
1720CachedPlanGetTargetList(CachedPlanSource *plansource,
1721 QueryEnvironment *queryEnv)
1722{
1723 Query *pstmt;
1724
1725 /* Assert caller is doing things in a sane order */
1726 Assert(plansource->magic == CACHEDPLANSOURCE_MAGIC);
1727 Assert(plansource->is_complete);
1728
1729 /*
1730 * No work needed if statement doesn't return tuples (we assume this
1731 * feature cannot be changed by an invalidation)
1732 */
1733 if (plansource->resultDesc == NULL)
1734 return NIL;
1735
1736 /* Make sure the querytree list is valid and we have parse-time locks */
1737 RevalidateCachedQuery(plansource, queryEnv, NULL);
1738
1739 /* Get the primary statement and find out what it returns */
1740 pstmt = QueryListGetPrimaryStmt(plansource->query_list);
1741
1742 return FetchStatementTargetList((Node *) pstmt);
1743}
1744
1745/*
1746 * GetCachedExpression: construct a CachedExpression for an expression.

Calls 3

RevalidateCachedQueryFunction · 0.85
QueryListGetPrimaryStmtFunction · 0.85
FetchStatementTargetListFunction · 0.85

Tested by

no test coverage detected