You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the awesome new Copy.rows method works great while the COPY operation is running, but appears to leave the connection in an unclean state. Attempting to run another query on the connection, or exit the context manager for the connection, results in "sending query failed: another command is already in progress".
$ cat repro.py
from psycopg3.oids import builtins
import psycopg3
with psycopg3.connect() as conn:
with conn.cursor() as cur:
with cur.copy("COPY (VALUES (1), (2), (3)) TO STDOUT (FORMAT BINARY)") as copy:
copy.set_types([builtins["int4"].oid])
for row in copy.rows():
print(row)
$ python repro.py
(1,)
(2,)
(3,)
Traceback (most recent call last):
File "repro.py", line 9, in <module>
print(row)
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/connection.py", line 435, in __exit__
self.commit()
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/connection.py", line 465, in commit
self.wait(self._commit_gen())
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/connection.py", line 510, in wait
return waiting.wait(gen, self.pgconn.socket, timeout=timeout)
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/waiting.py", line 223, in wait_epoll
s = next(gen)
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/connection.py", line 380, in _commit_gen
yield from self._exec_command(b"commit")
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/connection.py", line 346, in _exec_command
self.pgconn.send_query(command)
File "/home/benesch/Sites/psycopg3-play/venv/lib/python3.8/site-packages/psycopg3/pq/pq_ctypes.py", line 242, in send_query
raise PQerror(f"sending query failed: {error_message(self)}")
psycopg3.pq.PQerror: sending query failed: another command is already in progress
The text was updated successfully, but these errors were encountered:
Using the awesome new
Copy.rows
method works great while the COPY operation is running, but appears to leave the connection in an unclean state. Attempting to run another query on the connection, or exit the context manager for the connection, results in "sending query failed: another command is already in progress".The text was updated successfully, but these errors were encountered: