From: Denis Laxalde Date: Tue, 30 Nov 2021 14:47:59 +0000 (+0100) Subject: Return PIPELINE_SYNC result alone in generators.fetch_many() X-Git-Tag: 3.1~146^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=baba5eddd6daaa394b662b77f1b9db5786615797;p=thirdparty%2Fpsycopg.git Return PIPELINE_SYNC result alone in generators.fetch_many() --- diff --git a/psycopg/psycopg/generators.py b/psycopg/psycopg/generators.py index 76583bbf3..2a4aeaf5d 100644 --- a/psycopg/psycopg/generators.py +++ b/psycopg/psycopg/generators.py @@ -125,6 +125,12 @@ def fetch_many(pgconn: PGconn) -> PQGen[List[PGresult]]: # for every request so let's break the endless loop. break + if res.status == pq.ExecStatus.PIPELINE_SYNC: + # PIPELINE_SYNC is not followed by a NULL, but we return it alone + # similarly to other result sets. + assert len(results) == 1, results + break + return results diff --git a/psycopg_c/psycopg_c/_psycopg/generators.pyx b/psycopg_c/psycopg_c/_psycopg/generators.pyx index 239494974..86461024e 100644 --- a/psycopg_c/psycopg_c/_psycopg/generators.pyx +++ b/psycopg_c/psycopg_c/_psycopg/generators.pyx @@ -137,6 +137,12 @@ def fetch_many(pq.PGconn pgconn) -> PQGen[List[PGresult]]: # for every request so let's break the endless loop. break + if status == libpq.PGRES_PIPELINE_SYNC: + # PIPELINE_SYNC is not followed by a NULL, but we return it alone + # similarly to other result sets. + assert len(results) == 1, results + break + return results