pgsql: Support INOUT arguments in procedures
Support INOUT arguments in procedures
In a top-level CALL, the values of INOUT arguments will be returned as a
result row. In PL/pgSQL, the values are assigned back to the input
arguments. In other languages, the same convention as for return a
record from a function is used. That does not require any code changes
in the PL implementations.
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/33803f67f1c4cb88733cce61207bbf2bd5b599cc
Modified Files
--------------
doc/src/sgml/plperl.sgml | 14 +++
doc/src/sgml/plpgsql.sgml | 16 +++
doc/src/sgml/plpython.sgml | 11 ++
doc/src/sgml/pltcl.sgml | 12 ++
doc/src/sgml/ref/call.sgml | 4 +
doc/src/sgml/ref/create_procedure.sgml | 7 +-
src/backend/catalog/pg_proc.c | 4 +-
src/backend/commands/functioncmds.c | 65 +++++++++--
src/backend/executor/functions.c | 51 +++++++++
src/backend/tcop/utility.c | 3 +-
src/backend/utils/fmgr/funcapi.c | 11 +-
src/include/commands/defrem.h | 3 +-
src/include/executor/functions.h | 2 +
src/include/funcapi.h | 3 +-
src/pl/plperl/expected/plperl_call.out | 25 +++++
src/pl/plperl/sql/plperl_call.sql | 22 ++++
src/pl/plpgsql/src/expected/plpgsql_call.out | 112 ++++++++++++++++++
.../plpgsql/src/expected/plpgsql_transaction.out | 2 +-
src/pl/plpgsql/src/pl_comp.c | 10 +-
src/pl/plpgsql/src/pl_exec.c | 125 ++++++++++++++++++++-
src/pl/plpgsql/src/pl_funcs.c | 25 +++++
src/pl/plpgsql/src/pl_gram.y | 37 ++++--
src/pl/plpgsql/src/pl_scanner.c | 1 +
src/pl/plpgsql/src/plpgsql.h | 12 ++
src/pl/plpgsql/src/sql/plpgsql_call.sql | 107 ++++++++++++++++++
src/pl/plpython/expected/plpython_call.out | 23 ++++
src/pl/plpython/plpy_exec.c | 24 ++--
src/pl/plpython/sql/plpython_call.sql | 20 ++++
src/pl/tcl/expected/pltcl_call.out | 26 +++++
src/pl/tcl/sql/pltcl_call.sql | 23 ++++
src/test/regress/expected/create_procedure.out | 23 +++-
src/test/regress/sql/create_procedure.sql | 19 ++++
32 files changed, 792 insertions(+), 50 deletions(-)
On 2018-03-14 17:09, Peter Eisentraut wrote:
Support INOUT arguments in procedures
gcc 6.3.0 (on debian stretch) mutters:
pl_exec.c: In function ‘exec_stmt_call’:
pl_exec.c:2089:10: warning: variable ‘numargs’ set but not used
[-Wunused-but-set-variable]
int numargs;
^~~~~~~
On 3/14/18 12:45, Erik Rijkers wrote:
On 2018-03-14 17:09, Peter Eisentraut wrote:
Support INOUT arguments in procedures
gcc 6.3.0 (on debian stretch) mutters:
pl_exec.c: In function ‘exec_stmt_call’:
pl_exec.c:2089:10: warning: variable ‘numargs’ set but not used
[-Wunused-but-set-variable]
int numargs;
^~~~~~~
I don't get that, and buildfarm animals of similar configuration don't
either. Are you using a nonstandard configuration perhaps?
(I don't mind fixing it, but it'd be good to be able to reproduce it.)
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
On 3/14/18 12:45, Erik Rijkers wrote:
pl_exec.c: In function ‘exec_stmt_call’:
pl_exec.c:2089:10: warning: variable ‘numargs’ set but not used
[-Wunused-but-set-variable]
I don't get that, and buildfarm animals of similar configuration don't
either. Are you using a nonstandard configuration perhaps?
Not using --enable-cassert, evidently. You need to add
PG_USED_FOR_ASSERTS_ONLY.
regards, tom lane
On 3/14/18 14:28, Tom Lane wrote:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
On 3/14/18 12:45, Erik Rijkers wrote:
pl_exec.c: In function ‘exec_stmt_call’:
pl_exec.c:2089:10: warning: variable ‘numargs’ set but not used
[-Wunused-but-set-variable]I don't get that, and buildfarm animals of similar configuration don't
either. Are you using a nonstandard configuration perhaps?Not using --enable-cassert, evidently. You need to add
PG_USED_FOR_ASSERTS_ONLY.
OK, fixed.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On 2018-03-14 19:28, Tom Lane wrote:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
On 3/14/18 12:45, Erik Rijkers wrote:
pl_exec.c: In function ‘exec_stmt_call’:
pl_exec.c:2089:10: warning: variable ‘numargs’ set but not used
[-Wunused-but-set-variable]I don't get that, and buildfarm animals of similar configuration don't
either. Are you using a nonstandard configuration perhaps?Not using --enable-cassert, evidently. You need to add
PG_USED_FOR_ASSERTS_ONLY.
Yes, I always compile 2 binaries, one with asserts enabled and one
without it; I guess I should have noticed that my other compile didn't
give the warning.