diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-10-14 19:06:26 +0200 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2022-10-14 19:06:26 +0200 |
commit | b8af4166ff96af9c7bed1b511d0356284a8b7766 (patch) | |
tree | c84cbc4282b9255612c991e27cf2818f64ec41cb /src/interfaces/libpq/fe-exec.c | |
parent | 3fe6f261f7a20cfc8e6809ae36bfe93d1f779751 (diff) | |
download | postgresql-b8af4166ff96af9c7bed1b511d0356284a8b7766.tar.gz postgresql-b8af4166ff96af9c7bed1b511d0356284a8b7766.zip |
libpq: Reset singlerow flag correctly in pipeline mode
When a query whose results were requested in single-row mode is the last
in the queue by the time those results are being read, the single-row
flag was not being reset, because we were returning early from
pqPipelineProcessQueue. Move that stanza up so that the flag is always
reset at the end of sending that query's results.
Add a test for the situation.
Backpatch to 14.
Author: Denis Laxalde <denis.laxalde@dalibo.com>
Discussion: https://postgr.es/m/01af18c5-dacc-a8c8-07ee-aecc7650c3e8@dalibo.com
Diffstat (limited to 'src/interfaces/libpq/fe-exec.c')
-rw-r--r-- | src/interfaces/libpq/fe-exec.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 31b17bc2a60..1800d7365be 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -3089,6 +3089,12 @@ pqPipelineProcessQueue(PGconn *conn) } /* + * Reset single-row processing mode. (Client has to set it up for each + * query, if desired.) + */ + conn->singleRowMode = false; + + /* * If there are no further commands to process in the queue, get us in * "real idle" mode now. */ @@ -3101,12 +3107,6 @@ pqPipelineProcessQueue(PGconn *conn) /* Initialize async result-accumulation state */ pqClearAsyncResult(conn); - /* - * Reset single-row processing mode. (Client has to set it up for each - * query, if desired.) - */ - conn->singleRowMode = false; - if (conn->pipelineStatus == PQ_PIPELINE_ABORTED && conn->cmd_queue_head->queryclass != PGQUERY_SYNC) { |