Re: retrieving results of procedures with OUT params

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "ch(dot)l(dot)ngre" <ch(dot)l(dot)ngre(at)online(dot)de>
Cc: PostgreSQL Documentation <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: retrieving results of procedures with OUT params
Date: 2024-09-07 20:07:53
Message-ID: CAKFQuwZxN9-JePwbGHoL+mJReGbF_9mHWR3PiYfXidQJDNBz0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sat, Sep 7, 2024, 11:56 ch.l.ngre <ch(dot)l(dot)ngre(at)online(dot)de> wrote:

>
>
>
> You are right, the documentation for CALL states that a row is being
> returned.
> However if you read
> https://www.postgresql.org/docs/current/xproc.html#XPROC
> 'Procedures do not return a function value; hence CREATE PROCEDURE lacks
> a RETURNS clause. However, procedures can instead return data to their
> callers via output parameters'
> this does not sound like a row being returned.

Correct, because from the perspective of the procedure all it is aware of
is it's output arguments. The caller is either SQL CALL or plpgsql (or
someone else) which deal with those outputs differently.

Also plpgsql does not do
> it when you invoke CALL.
> The libpq documentation does not mention CALL of a stored procedure with
> out params at all. Maybe it should, - somewhere.
>

It's better from a pure separation of concerns if libpq has no awareness
that CALL was the command only seeing that whatever the SQL a tuple exists
on the wire to be processed.

That is the crux of the hesitation here, you are breaking
encapsulation/isolation of concerns. Libpq has little need or desire to be
aware of the specific SQL commands being passed around. It is a
client-server message passing protocol.

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2024-09-08 04:43:01 Mathematical Functions and Operators
Previous Message ch.l.ngre 2024-09-07 18:57:08 Re: retrieving results of procedures with OUT params