From: Daniele Varrazzo Date: Sat, 21 Mar 2020 21:26:09 +0000 (+1300) Subject: Break endless loop of response on COPY X-Git-Tag: 3.0.dev0~684 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba38fcffce78131e2aad4ec5e2c3ffaee2c43928;p=thirdparty%2Fpsycopg.git Break endless loop of response on COPY --- diff --git a/psycopg3/connection.py b/psycopg3/connection.py index fd14c3052..bb3f86f57 100644 --- a/psycopg3/connection.py +++ b/psycopg3/connection.py @@ -100,6 +100,14 @@ class BaseConnection: if res is None: break results.append(res) + if res.status in ( + pq.ExecStatus.COPY_IN, + pq.ExecStatus.COPY_OUT, + pq.ExecStatus.COPY_BOTH, + ): + # After entering copy mode the libpq will create a phony result + # for every request so let's break the endless loop. + break return results