View Ticket
Not logged in
Ticket UUID: 873cae2b6e25b1991ce5e9b782f9cd0409b96063
Title: Schema corruption after aborted CREATE TABLE AS
Status: Fixed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2015-06-16 16:39:22
Version Found In:
User Comments:
drh added on 2015-06-16 16:27:47: (text/x-fossil-wiki)
When a CREATE TABLE AS statement is part of a larger transaction and it aborts
due to an error condition in the SELECT on the right-hand side, this can leave
the sqlite3_master table with a blank entry which subsequent database
connections will interpret as a corrupt database.  The following SQL
illustrates the problem:

CREATE TABLE t1 AS SELECT zeroblob(2e20);
PRAGMA integrity_check;

This problem predates SQLite 3.5.1 (circa 2007).