| 349 | |
| 350 | @pytest.mark.crdb_skip("deferrable") |
| 351 | async def test_commit_error(aconn): |
| 352 | await aconn.execute(""" |
| 353 | drop table if exists selfref; |
| 354 | create table selfref ( |
| 355 | x serial primary key, |
| 356 | y int references selfref (x) deferrable initially deferred) |
| 357 | """) |
| 358 | await aconn.commit() |
| 359 | |
| 360 | await aconn.execute("insert into selfref (y) values (-1)") |
| 361 | with pytest.raises(e.ForeignKeyViolation): |
| 362 | await aconn.commit() |
| 363 | assert aconn.pgconn.transaction_status == pq.TransactionStatus.IDLE |
| 364 | cur = await aconn.execute("select 1") |
| 365 | assert await cur.fetchone() == (1,) |
| 366 | |
| 367 | |
| 368 | async def test_rollback(aconn): |