SQLite Forum

Bug: Database schema corruption
Login
Yes, but this behaviour ONLY exists inside a transaction.  

In autocommit it does not exist.

So the underlying cause of the difficulty has to do with the statement backout in an explicit transaction since it functions correctly in an implicit transaction.

```
SQLite version 3.34.0 2020-10-26 16:56:18
Enter ".help" for usage hints.
sqlite> create view if not exists if as select null;
Error: malformed database schema (if) - near "as": syntax error
sqlite> .schema
sqlite> create table x(x);
sqlite> insert into x values (1),(2);
sqlite> select * from x;
1
2
sqlite> create view if not exists if as select null;
Error: malformed database schema (if) - near "as": syntax error
sqlite> select * from x;
1
2
sqlite> .schema
CREATE TABLE x(x);
sqlite> begin;
sqlite> create view if not exists if as select null;
Error: malformed database schema (if) - near "as": syntax error
sqlite> .schema
Error: malformed database schema (if) - near "as": syntax error
sqlite> select * from x;
Error: malformed database schema (if) - near "as": syntax error
sqlite> rollback;
sqlite> .schema
CREATE TABLE x(x);
sqlite> select * from x;
1
2
```