SQLite Forum

cannot start a transaction within a transaction using sqlite shell
Login
I also noticed that if I leave the database in the default journal mode of delete, I can do a read-only transaction and cause the same error:

`while ! sqlite3 test.db 'begin;select count(*) from foo;end;'; do true ; done`

which produces the following output:
`
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
Error: database is locked
36943
`

and the other window starts showing:
`
Error: near line 871305: cannot start a transaction within a transaction
Error: near line 871306: cannot start a transaction within a transaction
Error: near line 871307: cannot start a transaction within a transaction
Error: near line 871308: cannot start a transaction within a transaction
Error: near line 871309: cannot start a transaction within a transaction
Error: near line 871310: cannot start a transaction within a transaction
Error: near line 871311: cannot start a transaction within a transaction
Error: near line 871312: cannot start a transaction within a transaction
Error: near line 871313: cannot start a transaction within a transaction
Error: near line 871314: cannot start a transaction within a transaction
Error: near line 871315: cannot start a transaction within a transaction
Error: near line 871316: cannot start a transaction within a transaction
Error: near line 871317: cannot start a transaction within a transaction
`

In WAL mode, read-only transactions work just fine, but read-write transactions still cause the error.