pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Denis Laxalde <denis.laxalde@dalibo.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: [PATCH] Reset single-row processing mode at end of pipeline commands queue
Date: Fri, 14 Oct 2022 19:34:58 +0200
Message-ID: <20221014173458.iacteadybkaja5sy@alvherre.pgsql> (raw)
In-Reply-To: <01af18c5-dacc-a8c8-07ee-aecc7650c3e8@dalibo.com>

Hello Denis,

On 2022-Oct-07, Denis Laxalde wrote:

> I'm trying to make single-row mode and pipeline mode work together in
> Psycopg using libpq. I think there is something wrong with respect to the
> single-row mode flag, not being correctly reset, in some situations.
> 
> The minimal case I'm considering is (in a pipeline):
> * send query 1,
> * get its results in single-row mode,
> * send query 2,
> * get its results *not* in single-row mode.
> 
> It seems that, as the command queue in the pipeline is empty after getting
> the results of query 1, the single-row mode flag is not reset and is still
> active for query 2, thus leading to an unexpected PGRES_SINGLE_TUPLE status.
> 
> The attached patch demonstrates this in the test suite. It also suggests to
> move the statement resetting single-row mode up in pqPipelineProcessQueue(),
> before exiting the function when the command queue is empty in particular.

Your suggestion to move the code up seems correct to me.  Therefore, I
have pushed this including the added test code.  Thanks for an excellent
report and patch.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/





view thread (2+ messages)

Message-ID: <20221014173458.iacteadybkaja5sy@alvherre.pgsql>
Permalink:  ../20221014173458.iacteadybkaja5sy@alvherre.pgsql/
Also on:    postgresql.org/message-id/20221014173458.iacteadybkaja5sy@alvherre.pgsql

 · 

reply

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-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, denis.laxalde@dalibo.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH] Reset single-row processing mode at end of pipeline commands queue
  In-Reply-To: <20221014173458.iacteadybkaja5sy@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