psycopg.git / summary / log / commit / refs
commit ba38fcffce78131e2aad4ec5e2c3ffaee2c43928
Author: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Date: Sat Mar 21 21:26:09 2020 +0000
Break endless loop of response on COPY
psycopg3/connection.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/psycopg3/connection.py b/psycopg3/connection.py
index fd14c305..bb3f86f5 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
[parent: 50ea4f1e7602]