Re: Using PQexecQuery in pipeline mode produces unexpected Close messages

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Álvaro Herrera <alvherre@alvh.no-ip.org>
To: "Kyotaro Horiguchi" <horikyota.ntt@gmail.com>
Cc: daniele.varrazzo@gmail.com, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2022-06-13T11:09:48Z
Lists: pgsql-bugs, pgsql-hackers
On Fri, Jun 10, 2022, at 8:25 AM, Kyotaro Horiguchi wrote:
> 
> The current implement of PQsendQueryInternal looks like the result of
> a misunderstanding of the doc.  In the regression tests, that path is
> excercised only for an error case, where no CloseComplete comes.
> 
> The attached adds a test for the normal-path of pipelined
> PQsendQuery() to simple_pipeline test then modifies that function not
> to send Close message. Without the fix, the test fails by "unexpected
> notice" even if the trace matches the "expected" content.

Hah, the patch I wrote is almost identical to yours, down to the notice processor counting the number of notices received.  The only difference is that I put my test in pipeline_abort.

Sadly, it looks like I won't be able to get this patched pushed for 14.4.

Commits

  1. 001_libpq_pipeline.pl: use Test::Differences if available

  2. libpq: Improve idle state handling in pipeline mode