-
-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Description
In a test like this:
cur = conn.cursor()
with pytest.raises(ZeroDivisionError):
with cur.copy("copy (select generate_series(1, 2)) to stdout") as copy:
copy.read_row()
1 / 0the connection is left in state ACTIVE, so we cannot do anything anymore with it.
The libpq doesn't have a command to terminate the COPY_OUT, as it has for COPY_IN. What we can do is to try and cancel the query, then consume the dataset until finished.
From a few preliminary tests, the server may or may not have already transferred the whole dataset to the client. If that's the case, the connection is left IDLE, otherwise it is left INERROR, when the QueryCanceled kicks in.
Metadata
Metadata
Assignees
Labels
No labels