New submission from Erlend E. Aasland <erlend.aasl...@innova.no>:

Ref. bpo-33376 and bpo-10513.

Quoting from the SQLite 3.7.11 changelog[1]:
"Pending statements no longer block ROLLBACK. Instead, the pending statement 
will return SQLITE_ABORT upon next access after the ROLLBACK."

Quoting from the SQLite 3.8.7.2 changelog[2]:
"Enhance the ROLLBACK command so that pending queries are allowed to continue 
as long as the schema is unchanged. Formerly, a ROLLBACK would cause all 
pending queries to fail with an SQLITE_ABORT or SQLITE_ABORT_ROLLBACK error. 
That error is still returned if the ROLLBACK modifies the schema."

Quoting from the SQLite docs[3]:
"In more recent versions of SQLite, the ROLLBACK will proceed and pending 
statements will often be aborted, causing them to return an SQLITE_ABORT or 
SQLITE_ABORT_ROLLBACK error. In SQLite version 3.8.8 (2015-01-16) and later, a 
pending read will continue functioning after the ROLLBACK as long as the 
ROLLBACK does not modify the database schema."

I've done some tests with SQLite versions 3.35.4 and 3.7.15 where I've removed 
the call to pysqlite_do_all_statements() (introduced by [4]) in 
pysqlite_connection_rollback_impl(), and I've also removed the 
pysqlite_Cursor.reset member and all of the related code. The test suite passes 
fine (except for, as expected, the two tests that check for InterfaceError in 
case of fetch across rollback).

Do we really need to special case rollbacks anymore? I've tried to come up with 
tests that prove this approach wrong, but I haven't found any yet.


[1] https://sqlite.org/changes.html#version_3_7_11
[2] https://sqlite.org/changes.html#version_3_8_7_2
[3] https://www.sqlite.org/lang_transaction.html
[4] 
https://github.com/ghaering/pysqlite/commit/95f0956d9a78750ac8b5ca54f028b5f8d8db0abb

----------
components: Extension Modules
messages: 393338
nosy: berker.peksag, erlendaasland, lemburg, serhiy.storchaka
priority: normal
severity: normal
status: open
title: [sqlite3] consider removing special rollback handling
versions: Python 3.11

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44092>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to