SQLite User Forum

Error Cannot rollback - no transaction is active
Login

Error Cannot rollback - no transaction is active

(1) By epoberezkin on 2022-09-03 07:55:44 [source]

Hello!

This error does show up in searches, but the cases seem different, sorry if this is a duplicate.

We have an issue specifically when running SQLite on Android - when the record is deleted with FK enabled, the query may fail, depending on the data, with "ErrorError while attempting to perform step: cannot rollback - no transaction is active".

What is weird, it happens only on Android. SQLite is compiled from exactly the same amalgamation, with the same options. The same query with the same database works on all other platforms (ios, linux, mac, windows).

The only workaround we could find was to break down the query to multiple transactions, and instead of relying on FK to make cascade deletions, delete dependent records explicitly. But this is not really a viable workaround, as sometimes we do not see the issue and it only happens for the users, for their particular databases (which they cannot share with us, obviously)...

SQLite version: 3.38.5 Options: SQLITE_ENABLE_FTS3 SQLITE_ENABLE_FTS3_PARENTHESIS SQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 SQLITE_USE_URI HAVE_USLEEP SQLITE_ENABLE_JSON1

(2) By Simon Slavin (slavin) on 2022-09-03 12:15:51 in reply to 1 [link] [source]

I understand from the above that you have included SQLite in your project by including the amalgamation C file. If this is wrong, please correct me.

Can you tell us which API you're using ? Are you calling the C API or some other library or shim ?

Are you checking the result code of all the previous calls to SQLite ? For instance, did you check the result of the call which deleted the record ?