aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/sql
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-10-05 09:09:09 +0200
committerPeter Eisentraut <peter@eisentraut.org>2020-10-05 09:21:43 +0200
commit2453ea142233ae57af452019c3b9a443dad1cdd0 (patch)
treec38325aa838a785924c9add942c17021e3e8098b /src/pl/plpython/sql
parente899742081fa24bf52d4a32103ef854a3a85865d (diff)
downloadpostgresql-2453ea142233ae57af452019c3b9a443dad1cdd0.tar.gz
postgresql-2453ea142233ae57af452019c3b9a443dad1cdd0.zip
Support for OUT parameters in procedures
Unlike for functions, OUT parameters for procedures are part of the signature. Therefore, they have to be listed in pg_proc.proargtypes as well as mentioned in ALTER PROCEDURE and DROP PROCEDURE. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com> Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/2b8490fe-51af-e671-c504-47359dc453c5@2ndquadrant.com
Diffstat (limited to 'src/pl/plpython/sql')
-rw-r--r--src/pl/plpython/sql/plpython_call.sql19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pl/plpython/sql/plpython_call.sql b/src/pl/plpython/sql/plpython_call.sql
index 2f792f92bd7..46e89b1a9e1 100644
--- a/src/pl/plpython/sql/plpython_call.sql
+++ b/src/pl/plpython/sql/plpython_call.sql
@@ -54,6 +54,25 @@ $$;
CALL test_proc6(2, 3, 4);
+-- OUT parameters
+
+CREATE PROCEDURE test_proc9(IN a int, OUT b int)
+LANGUAGE plpythonu
+AS $$
+plpy.notice("a: %s, b: %s" % (a, b))
+return (a * 2,)
+$$;
+
+DO $$
+DECLARE _a int; _b int;
+BEGIN
+ _a := 10; _b := 30;
+ CALL test_proc9(_a, _b);
+ RAISE NOTICE '_a: %, _b: %', _a, _b;
+END
+$$;
+
+
DROP PROCEDURE test_proc1;
DROP PROCEDURE test_proc2;
DROP PROCEDURE test_proc3;