Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ec67b898
Commit
ec67b898
authored
Jul 09, 2018
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add UtilityReturnsTuples() support for CALL
This ensures that prepared statements for CALL can return tuples.
parent
cccf81d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
src/backend/commands/functioncmds.c
src/backend/commands/functioncmds.c
+24
-0
src/backend/tcop/utility.c
src/backend/tcop/utility.c
+9
-0
src/include/commands/defrem.h
src/include/commands/defrem.h
+1
-0
No files found.
src/backend/commands/functioncmds.c
View file @
ec67b898
...
...
@@ -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
;
}
src/backend/tcop/utility.c
View file @
ec67b898
...
...
@@ -1744,6 +1744,12 @@ UtilityReturnsTuples(Node *parsetree)
{
switch
(
nodeTag
(
parsetree
))
{
case
T_CallStmt
:
{
CallStmt
*
stmt
=
(
CallStmt
*
)
parsetree
;
return
(
stmt
->
funcexpr
->
funcresulttype
==
RECORDOID
);
}
case
T_FetchStmt
:
{
FetchStmt
*
stmt
=
(
FetchStmt
*
)
parsetree
;
...
...
@@ -1794,6 +1800,9 @@ UtilityTupleDescriptor(Node *parsetree)
{
switch
(
nodeTag
(
parsetree
))
{
case
T_CallStmt
:
return
CallStmtResultDesc
((
CallStmt
*
)
parsetree
);
case
T_FetchStmt
:
{
FetchStmt
*
stmt
=
(
FetchStmt
*
)
parsetree
;
...
...
src/include/commands/defrem.h
View file @
ec67b898
...
...
@@ -64,6 +64,7 @@ extern void IsThereFunctionInNamespace(const char *proname, int pronargs,
oidvector
*
proargtypes
,
Oid
nspOid
);
extern
void
ExecuteDoStmt
(
DoStmt
*
stmt
,
bool
atomic
);
extern
void
ExecuteCallStmt
(
CallStmt
*
stmt
,
ParamListInfo
params
,
bool
atomic
,
DestReceiver
*
dest
);
extern
TupleDesc
CallStmtResultDesc
(
CallStmt
*
stmt
);
extern
Oid
get_cast_oid
(
Oid
sourcetypeid
,
Oid
targettypeid
,
bool
missing_ok
);
extern
Oid
get_transform_oid
(
Oid
type_id
,
Oid
lang_id
,
bool
missing_ok
);
extern
void
interpret_function_parameter_list
(
ParseState
*
pstate
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment