]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(crdb): add test reproducing failure with prepared create statement
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 18 Mar 2025 14:46:35 +0000 (15:46 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 8 Apr 2025 13:45:40 +0000 (14:45 +0100)
See #1009

tests/crdb/test_connection.py
tests/crdb/test_connection_async.py

index b935e8530995035482c6cc5e7e9f0982b431b778..0542465046723c82c9c6936fc363ef39b612ece8 100644 (file)
@@ -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)"
+        )
index f965ccc5b15fb25758db3fcbff95f9a140a34f90..a194a0a244ae58eda188eca57e8fd1e2e0b94b83 100644 (file)
@@ -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)"
+        )