mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Add UtilityReturnsTuples() support for CALL
This ensures that prepared statements for CALL can return tuples.
This commit is contained in:
@ -51,6 +51,7 @@
|
||||
#include "commands/proclang.h"
|
||||
#include "executor/execdesc.h"
|
||||
#include "executor/executor.h"
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/var.h"
|
||||
@ -2340,3 +2341,26 @@ ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver
|
||||
|
||||
FreeExecutorState(estate);
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct the tuple descriptor for a CALL statement return
|
||||
*/
|
||||
TupleDesc
|
||||
CallStmtResultDesc(CallStmt *stmt)
|
||||
{
|
||||
FuncExpr *fexpr;
|
||||
HeapTuple tuple;
|
||||
TupleDesc tupdesc;
|
||||
|
||||
fexpr = stmt->funcexpr;
|
||||
|
||||
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(fexpr->funcid));
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "cache lookup failed for procedure %u", fexpr->funcid);
|
||||
|
||||
tupdesc = build_function_result_tupdesc_t(tuple);
|
||||
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
return tupdesc;
|
||||
}
|
||||
|
Reference in New Issue
Block a user