improve PQexec documentation

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: improve PQexec documentation
Date: 2019-04-12 08:38:49
Message-ID: alpine.DEB.2.21.1904121016310.8912@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello devs,

I'm looking at psql's use of PQexec for implementing some feature.

When running with multiple SQL commands, the doc is not very helpful.

From the source code I gathered that PQexec returns the first COPY results
if any, and if not the last non-empty results, unless all is empty in
which case an empty result is returned. So * marks the returned result
in the following examples:

INSERT ... \; * COPY ... \; SELECT ... \; \;
SELECT ... \; UPDATE ... \; * SELECT ... \; \;
\; \; * ;

The attached patch tries to improve the documentation based on my
understanding.

IMVHO, psql's code is kind of a mess to work around this strange behavior,
as there is a loop over results within PQexec, then another one after
PQexec if there were some COPY.

--
Fabien.

Attachment Content-Type Size
libpq-pqexec-doc-1.patch text/x-diff 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2019-04-12 08:48:33 Re: Attempt to consolidate reading of XLOG page
Previous Message Peter Eisentraut 2019-04-12 08:22:03 Re: [PATCH v20] GSSAPI encryption support