]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: keep a lock for the entire duration of executemany
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 6 Sep 2025 01:00:24 +0000 (03:00 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 6 Sep 2025 20:14:20 +0000 (22:14 +0200)
commit786a6b2859d9dd41fb44f63a8d089fbc04acaa96
treedad5a6c8226cd5799487672e6d948802d91ac135
parent5565b3251e3546b5131e88fff1d47036b7979926
fix: keep a lock for the entire duration of executemany

Before this change we had the lock context inside the pipeline context,
because conn.pipepline() and Pipeline.__enter/exit__ take a lock. But
this created windows of opportunities for other threads to execute
concurrent operations on the connection, resulting in "another command
is already in progress" errors.

Fix #1130.
docs/news.rst
psycopg/psycopg/_pipeline.py
psycopg/psycopg/_pipeline_async.py
psycopg/psycopg/connection.py
psycopg/psycopg/connection_async.py
psycopg/psycopg/cursor.py
psycopg/psycopg/cursor_async.py
tests/test_cursor_common.py
tests/test_cursor_common_async.py