From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | INOUT parameters in procedures |
Date: | 2018-02-28 22:28:51 |
Message-ID: | c62dc063-55b2-1004-679c-727736d18436@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
This patch set adds support for INOUT parameters to procedures.
Currently, INOUT and OUT parameters are not supported.
A top-level CALL returns the output parameters as a result row. In
PL/pgSQL, I have added special support to pass the output back into the
variables, as one would expect.
These patches apply on top of the "prokind" patch set v2. (Tom has
submitted an updated version of that, which overlaps with some of the
changes I've made here. I will work on consolidating that soon.)
So ... no OUT parameters, though. I'm struggling to find a way to make
this compatible with everything else. For functions, the OUT parameters
don't appear in the signature. But that is not how this is specified in
the SQL standard for procedures (I think). In PL/pgSQL, you'd expect that
CREATE PROCEDURE foo(a int, OUT b int) ...
could be called like
CALL foo(x, y);
but that would require a different way of parsing function invocation.
At the top-level, it's even more dubious. In DB2, apparently you write
CALL foo(123, ?);
with a literal ? for the OUT parameters.
In Oracle, I've seen CALL ... INTO syntax.
Anyway, I'm leaving this out for now. It can be worked around by using
INOUT parameters. Future improvements would be mainly syntax/parsing
adjustments; the guts that I'm implementing here would remain valid.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
v1-0001-fixup-Add-prokind-column-replacing-proisagg-and-p.patch | text/plain | 3.6 KB |
v1-0002-Support-INOUT-parameters-in-procedures.patch | text/plain | 22.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2018-02-28 22:37:11 | Re: prokind column (was Re: [HACKERS] SQL procedures) |
Previous Message | Justin Pryzby | 2018-02-28 22:28:24 | Re: RFC: Add 'taint' field to pg_control. |