mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
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>
This commit is contained in:
@@ -278,6 +278,20 @@ SELECT * FROM perl_row();
|
||||
hash will be returned as null values.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Similarly, output arguments of procedures can be returned as a hash
|
||||
reference:
|
||||
|
||||
<programlisting>
|
||||
CREATE PROCEDURE perl_triple(INOUT a integer, INOUT b integer) AS $$
|
||||
my ($a, $b) = @_;
|
||||
return {a => $a * 3, b => $b * 3};
|
||||
$$ LANGUAGE plperl;
|
||||
|
||||
CALL perl_triple(5, 10);
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
PL/Perl functions can also return sets of either scalar or
|
||||
composite types. Usually you'll want to return rows one at a
|
||||
|
||||
Reference in New Issue
Block a user