From f55ecc367390b3265570bc2e12e91dd40fe3179e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Fri, 12 Sep 2025 17:14:00 +0200 Subject: [PATCH] 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 --- tests/_test_cursor.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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: -- 2.47.3