SQLite Forum

RAISE(ROLLBACK,...) giving 'no transaction error'
Login
As an aside I note that on the current trunk there is no such situation.

I would note that since it is impossible for a "trigger" to fire other than within a transaction context, that **ROLLBACK** would always be successful whether or not the transaction scope being rolled back was merely the current statement (as in an implicit transaction) or some other explicit transaction context.

I have no idea when or where it was changed.  Richard may have info on this.

What version of SQLite3 are you observing the behaviour of which you speak?

```
SQLite version 3.34.0 2020-09-14 08:14:15
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table x(x);
sqlite> create trigger ix before insert on x begin select raise(ROLLBACK, 'Transaction Rollback'); end;
sqlite> insert into x values (1);
Error: Transaction Rollback
sqlite> drop trigger ix;
sqlite> create trigger ix after insert on x begin select raise(ROLLBACK, 'Transaction Rollback'); end;
sqlite> select * from x;
sqlite> insert into x values (1);
Error: Transaction Rollback
sqlite> select * from x;
sqlite> begin;
sqlite> insert into x values (1);
Error: Transaction Rollback
sqlite> rollback;
Error: cannot rollback - no transaction is active
```