Re: Using PQexecQuery in pipeline mode produces unexpected Close messages

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

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Date: 2022-06-08T15:08:47Z
Lists: pgsql-bugs, pgsql-hackers
On 2022-Jun-08, Daniele Varrazzo wrote:

> Is this a problem with PQexecQuery which should not send the Close, or
> with receiving in IDLE mode which should expect a CloseComplete?

Interesting.

What that Close message is doing is closing the unnamed portal, which
is otherwise closed implicitly when the next one is opened.  That's how
single-query mode works: if you run a single portal, it'll be kept open.

I believe that the right fix is to not send that Close message in
PQsendQuery.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Para tener más hay que desear menos"



Commits

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

  2. libpq: Improve idle state handling in pipeline mode