From 6490d773dd2fae3a9db6ac9bc2137777f67e13b1 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 18 Mar 2025 15:46:35 +0100 Subject: [PATCH] test(crdb): add test reproducing failure with prepared create statement See #1009 --- tests/crdb/test_connection.py | 12 ++++++++++++ tests/crdb/test_connection_async.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tests/crdb/test_connection.py b/tests/crdb/test_connection.py index b935e8530..054246504 100644 --- a/tests/crdb/test_connection.py +++ b/tests/crdb/test_connection.py @@ -91,3 +91,15 @@ def test_identify_closure(conn_cls, dsn): assert 0.2 < dt < 2 finally: gather(t) + + +@pytest.mark.crdb("> 24.0", reason="autocommit_before_ddl not available") +def test_unknown_portal(conn): + # See #1009. The test fails with CRDB v25.1.2 with autocommit before DDL enabled. + conn.execute("set autocommit_before_ddl=on") + conn.commit() + for i in range(10): + conn.execute("drop table if exists integer_table") + conn.execute( + "create table integer_table (id serial primary key, integer_data bigint)" + ) diff --git a/tests/crdb/test_connection_async.py b/tests/crdb/test_connection_async.py index f965ccc5b..a194a0a24 100644 --- a/tests/crdb/test_connection_async.py +++ b/tests/crdb/test_connection_async.py @@ -91,3 +91,15 @@ async def test_identify_closure(aconn_cls, dsn): assert 0.2 < dt < 2 finally: await gather(t) + + +@pytest.mark.crdb("> 24.0", reason="autocommit_before_ddl not available") +async def test_unknown_portal(aconn): + # See #1009. The test fails with CRDB v25.1.2 with autocommit before DDL enabled. + await aconn.execute("set autocommit_before_ddl=on") + await aconn.commit() + for i in range(10): + await aconn.execute("drop table if exists integer_table") + await aconn.execute( + "create table integer_table (id serial primary key, integer_data bigint)" + ) -- 2.47.2