]> git.ipfire.org Git - thirdparty/psycopg.git/commit
fix: keep a lock for the entire duration of executemany 1159/head
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 17:10:40 +0000 (19:10 +0200)
commit6ee340a1fb8d28ca91ff5e68b11df22ed1764147
tree8a1348b4620ae161238fd2110daa7ba53aef1a01
parent9d12c61d10f7ac15b3eeeb3f246b244ee87a4499
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