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

Function UtilityTupleDescriptor

src/backend/tcop/utility.c:2756–2808  ·  view source on GitHub ↗

* UtilityTupleDescriptor * Fetch the actual output tuple descriptor for a utility statement * for which UtilityReturnsTuples() previously returned "true". * * The returned descriptor is created in (or copied into) the current memory * context. */

Source from the content-addressed store, hash-verified

2754 * context.
2755 */
2756TupleDesc
2757UtilityTupleDescriptor(Node *parsetree)
2758{
2759 switch (nodeTag(parsetree))
2760 {
2761 case T_CallStmt:
2762 return CallStmtResultDesc((CallStmt *) parsetree);
2763
2764 case T_FetchStmt:
2765 {
2766 FetchStmt *stmt = (FetchStmt *) parsetree;
2767 Portal portal;
2768
2769 if (stmt->ismove)
2770 return NULL;
2771 portal = GetPortalByName(stmt->portalname);
2772 if (!PortalIsValid(portal))
2773 return NULL; /* not our business to raise error */
2774 return CreateTupleDescCopy(portal->tupDesc);
2775 }
2776
2777 case T_ExecuteStmt:
2778 {
2779 ExecuteStmt *stmt = (ExecuteStmt *) parsetree;
2780 PreparedStatement *entry;
2781
2782 entry = FetchPreparedStatement(stmt->name, false);
2783 if (!entry)
2784 return NULL; /* not our business to raise error */
2785 return FetchPreparedStatementResultDesc(entry);
2786 }
2787
2788 case T_ExplainStmt:
2789 return ExplainResultDesc((ExplainStmt *) parsetree);
2790
2791 case T_VariableShowStmt:
2792 {
2793 VariableShowStmt *n = (VariableShowStmt *) parsetree;
2794
2795 return GetPGVariableResultDesc(n->name);
2796 }
2797
2798 case T_RetrieveStmt:
2799 {
2800 RetrieveStmt *n = (RetrieveStmt *) parsetree;
2801
2802 return CreateTupleDescCopy(GetRetrieveStmtTupleDesc(n));
2803 }
2804
2805 default:
2806 return NULL;
2807 }
2808}
2809
2810
2811/*

Callers 2

PortalStartFunction · 0.85

Calls 8

CallStmtResultDescFunction · 0.85
GetPortalByNameFunction · 0.85
CreateTupleDescCopyFunction · 0.85
FetchPreparedStatementFunction · 0.85
ExplainResultDescFunction · 0.85
GetPGVariableResultDescFunction · 0.85
GetRetrieveStmtTupleDescFunction · 0.85

Tested by

no test coverage detected