Re: Support for OUT parameters in procedures

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support for OUT parameters in procedures
Date: 2020-08-28 06:04:04
Message-ID: 7c2aa288-74fd-fe0a-58bb-d77055315047@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On 2020-08-27 15:56, Robert Haas wrote:
> On Thu, Aug 27, 2020 at 4:34 AM Peter Eisentraut
> <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>> For a top-level direct call, you can pass whatever you want, since all
>> OUT parameters are presented as initially NULL to the procedure code.
>> So you could just pass NULL, as in CALL test_proc(5, NULL).
>
> Is that actually how other systems work? I would think that people
> would expect to pass, say, a package variable, and expect that it will
> get updated.

The handling of results of SQL statements executed at the top level
(a.k.a. direct SQL) is implementation-specific and varies widely in
practice. More interesting in practice, in terms of functionality and
also compatibility, are nested calls in PL/pgSQL as well as integration
in JDBC.

We already support INOUT parameters in procedures, so the method of
returning the value of output parameters after the CALL already exists.
This patch doesn't touch that at all, really. If we had or would add
other places to put those results, such as package variables, then they
could be added independently of this patch.

Of course, feedback from those more knowledgeable in other systems than
me would be welcome.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2020-08-28 06:04:17 Re: Clang UndefinedBehaviorSanitize (Postgres14) Detected undefined-behavior
Previous Message Thomas Munro 2020-08-28 05:45:41 Re: Handing off SLRU fsyncs to the checkpointer

Browse pgsql-jdbc by date

  From Date Subject
Next Message Robert Haas 2020-08-28 13:30:46 Re: Support for OUT parameters in procedures
Previous Message Robert Haas 2020-08-27 13:56:47 Re: Support for OUT parameters in procedures