Re: PATCH: Batch/pipelining support for libpq - Mailing list pgsql-hackers

From Zhihong Yu
Subject Re: PATCH: Batch/pipelining support for libpq
Date
Msg-id CALNJ-vRrGUW=Uj0b5ZtdV_6=pV6Ge0pxBvfLrYxjvdhPPdKZmg@mail.gmail.com
Whole thread Raw
In response to Re: PATCH: Batch/pipelining support for libpq  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-hackers
Hi,

+                       commandFailed(st, "SQL", "\\gset and \\aset are not allowed in a batch section");

It seems '\\gset or \\aset is not ' would correspond to the check more closely.

+       if (my_command->argc != 1)
+           syntax_error(source, lineno, my_command->first_line, my_command->argv[0],

It is possible that my_command->argc == 0 (where my_command->argv[0] shouldn't be accessed) ?

+               appendPQExpBufferStr(&conn->errorMessage,
+                                 libpq_gettext("cannot queue commands during COPY\n"));
+               return false;
+               break;

Is the break necessary ? Similar comment for pqBatchProcessQueue().

+int
+PQexitBatchMode(PGconn *conn)

Since either 0 or 1 is returned, maybe change the return type to bool.
Also, the function operates on PGconn - should the function be static (pqBatchProcessQueue is) ?

Cheers

On Thu, Jan 21, 2021 at 3:39 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
Thanks David Johnston and Daniel Vérité, I have incorporated your
changes into this patch, which is now v26.  Also, it's been rebased on
current sources.

I've been using the new PQtrace() stuff to verify the behavior of the
new feature.  It's not perfect, but at least it doesn't crash
immediately as it did when I tried a few weeks ago.  There are
imperfections that I think are due to bugs in the PQtrace
implementation, not in this patch.

--
Álvaro Herrera                            39°49'30"S 73°17'W
"El conflicto es el camino real hacia la unión"

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: PATCH: Batch/pipelining support for libpq
Next
From: Michail Nikolaev
Date:
Subject: Re: [PATCH] Full support for index LP_DEAD hint bits on standby