agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: ch.l.ngre <ch.l.ngre@online.de>
To: David G. Johnston <david.g.johnston@gmail.com>
To: pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Subject: Re: retrieving results of procedures with OUT params
Date: Sat, 7 Sep 2024 20:57:08 +0200
Message-ID: <9823c60f-a482-4751-a94f-e14c29fe49d0@online.de> (raw)
In-Reply-To: <CAKFQuwbPqtEGDgGcpWwQ58pJqS52dBnQ_b2SRWHV93mCj+Swbg@mail.gmail.com>
References: <172527216699.692.9900337638245208778@wrigleys.postgresql.org>
	<CAKFQuwbPqtEGDgGcpWwQ58pJqS52dBnQ_b2SRWHV93mCj+Swbg@mail.gmail.com>



Am 07.09.2024 um 18:35 schrieb David G. Johnston:
> On Monday, September 2, 2024, PG Doc comments form
> <noreply@postgresql.org <mailto:noreply@postgresql.org>> wrote:
>
>     The following documentation comment has been logged on the website:
>
>     Page: https://www.postgresql.org/docs/16/libpq-exec.html
>     <https://www.postgresql.org/docs/16/libpq-exec.html;
>     Description:
>
>     https://www.postgresql.org/docs/16/libpq-exec.html#LIBPQ-PQRESULTSTATUS <https://www.postgresql.org/docs/16/libpq-exec.html#LIBPQ-PQRESULTSTATUS;
>     Existing text:
>     If the result status is PGRES_TUPLES_OK, PGRES_SINGLE_TUPLE, or
>     PGRES_TUPLES_CHUNK, then the functions described below can be used to
>     retrieve the rows returned by the query. Note that a SELECT command that
>     happens to retrieve zero rows still shows PGRES_TUPLES_OK.
>     PGRES_COMMAND_OK
>     is for commands that can never return rows (INSERT or UPDATE without a
>     RETURNING clause, etc.). A response of PGRES_EMPTY_QUERY might
>     indicate a
>     bug in the client software.
>     Add:
>     A successful call to a procedure with OUT parameters will set
>     PGRES_TUPLES_OK and return one row with the functions described below.
>
>
> Defining whether a given SQL query is or is not going to return tuples
> is not the responsibility of this paragraph.  The documentation for CALL
> is where this knowledge is imparted.  I’m not hard set against adding
> something here but it also doesn’t really seem like a need.
>
> If I were to do something I’d probably add “or a CALL of a procedure
> lacking OUT parameters, etc” as another example in the parenthetical
> talking about an omitted returning clause.
>
> David J.
>

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. 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.

Christoph





view thread (4+ messages)  latest in thread

Message-ID: <9823c60f-a482-4751-a94f-e14c29fe49d0@online.de>
Permalink:  ../9823c60f-a482-4751-a94f-e14c29fe49d0@online.de/
Also on:    postgresql.org/message-id/9823c60f-a482-4751-a94f-e14c29fe49d0@online.de

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: ch.l.ngre@online.de, david.g.johnston@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: retrieving results of procedures with OUT params
  In-Reply-To: <9823c60f-a482-4751-a94f-e14c29fe49d0@online.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox