|Title:||Malformed image when using no journal mode, zero cache size, and failing when creating an index.|
|Last Modified:||2019-05-17 20:40:46|
|Version Found In:||3.28|
mrigger added on 2019-05-17 12:48:17:
Consider the following example:
PRAGMA journal_mode=OFF; PRAGMA main.cache_size=0; CREATE TABLE IF NOT EXISTS t0 (c0); CREATE INDEX i0 ON t0(1); DROP INDEX "i0"; INSERT OR IGNORE INTO t0(c0) VALUES (1), (2); CREATE UNIQUE INDEX i0 ON t0(1); -- UNIQUE constraint failed: index 'i0' CREATE UNIQUE INDEX i0 ON t0(1); -- database disk image is malformed
Is this expected? The documentation mentions that the ROLLBACK statement cannot be used with journal_mode=OFF, but it does not mention failed index creation.
drh added on 2019-05-17 20:40:46:
This is the expected behavior when there is no journal available to rollback a partially completed operation that fails due to a constraint. The documentation has been strengthened to try to make this clear. And PRAGMA journal_mode=OFF is now disallowed if SQLITE_DBCONFIG_DEFENSIVE is turned on.