* 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. */
| 1717 | * within the cached plan, and may disappear next time the plan is updated. |
| 1718 | */ |
| 1719 | List * |
| 1720 | CachedPlanGetTargetList(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. |
no test coverage detected