From: Daniele Varrazzo Date: Fri, 12 Sep 2025 15:14:00 +0000 (+0200) Subject: test: fix tests with master version of crdb X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f55ecc367390b3265570bc2e12e91dd40fe3179e;p=thirdparty%2Fpsycopg.git test: fix tests with master version of crdb The server version reported is 250300. Tests fail with the error: psycopg.errors.OperatorIntervention: this schema change is disallowed because table "execmany" is locked and this operation cannot automatically unlock the table DETAIL: To unlock the table, execute `ALTER TABLE execmany SET (schema_locked = false);` After the schema change completes, we recommend setting it back to true with `ALTER TABLE execmany SET (schema_locked = true);`. HINT: Locking the table improves changefeed performance; see https://www.cockroachlabs.com/docs/dev/changefeed-best-practices.html#lock-the-schema-on-changefeed-watched-tables --- diff --git a/tests/_test_cursor.py b/tests/_test_cursor.py index ee4b4acae..fdc38daec 100644 --- a/tests/_test_cursor.py +++ b/tests/_test_cursor.py @@ -15,8 +15,7 @@ from psycopg.rows import RowMaker @pytest.fixture(scope="session") def _execmany(svcconn): - cur = svcconn.cursor() - cur.execute( + svcconn.execute( """ drop table if exists execmany; create table execmany (id serial primary key, num integer, data text) @@ -26,8 +25,7 @@ def _execmany(svcconn): @pytest.fixture(scope="function") def execmany(svcconn, _execmany): - cur = svcconn.cursor() - cur.execute("truncate table execmany") + svcconn.execute("delete from execmany") def ph(cur: Any, query: str) -> str: