[PATCH] Reset single-row processing mode at end of pipeline commands queue

From: Denis Laxalde <denis(dot)laxalde(at)dalibo(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] Reset single-row processing mode at end of pipeline commands queue
Date: 2022-10-07 13:08:05
Message-ID: 01af18c5-dacc-a8c8-07ee-aecc7650c3e8@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

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.

Thanks for considering,
Denis

Attachment Content-Type Size
0001-Reset-single-row-processing-mode-at-end-of-pipeline-.patch text/x-patch 5.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Verite 2022-10-07 13:18:54 Re: [patch] \g with multiple result sets and \watch with copy queries
Previous Message Peter Eisentraut 2022-10-07 12:10:44 Simplify event trigger support checking functions