From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: daniele.varrazzo@gmail.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Using PQexecQuery in pipeline mode produces unexpected Close messages
Date: Wed, 15 Jun 2022 20:26:33 +0200
Message-ID: <20220615182633.ztcoloh7xbicggot@alvherre.pgsql> (raw)
In-Reply-To: <20220610.152544.1597540405935332165.horikyota.ntt@gmail.com>
On 2022-Jun-10, Kyotaro Horiguchi wrote:
> (Moved to -hackers)
>
> At Wed, 8 Jun 2022 17:08:47 +0200, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote in
> > 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.
>
> Agreed. At least Close message in that context is useless and
> PQsendQueryGuts doesn't send it. And removes the Close message surely
> fixes the issue.
So, git archaeology led me to this thread
https://postgr.es/m/202106072107.d4i55hdscxqj@alvherre.pgsql
which is why we added that message in the first place.
I was about to push the attached patch (a merged version of Kyotaro's
and mine), but now I'm wondering if that's the right approach.
Alternatives:
- Have the client not complain if it gets CloseComplete in idle state.
(After all, it's a pretty useless message, since we already do nothing
with it if we get it in BUSY state.)
- Have the server not send CloseComplete at all in the cases where
the client is not expecting it. Not sure how this would be
implemented.
- Other ideas?
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"That sort of implies that there are Emacs keystrokes which aren't obscure.
I've been using it daily for 2 years now and have yet to discover any key
sequence which makes any sense." (Paul Thomas)
Attachments:
v2-0001-PQsendQuery-Don-t-send-Close-in-pipeline-mode.patch (text/x-diff, 0B) download
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-bugs@postgresql.org
Cc: alvherre@alvh.no-ip.org, horikyota.ntt@gmail.com, daniele.varrazzo@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Using PQexecQuery in pipeline mode produces unexpected Close messages
In-Reply-To: <20220615182633.ztcoloh7xbicggot@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox