SQLite

View Ticket
Login
Ticket Hash: f4ec250930342e0c146bade2571c10f43085be34
Title: Malformed image when using no journal mode, zero cache size, and failing when creating an index.
Status: Closed Type: Code_Defect
Severity: Minor Priority: Immediate
Subsystem: Code_Generator Resolution: Works_As_Designed
Last Modified: 2019-05-17 20:40:46
Version Found In: 3.28
User Comments:
mrigger added on 2019-05-17 12:48:17: (text/x-fossil-wiki)
Consider the following example:

<pre>
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
</pre>

Is this expected? The documentation mentions that the <i>ROLLBACK</i> statement cannot be used with <i>journal_mode=OFF</i>, but it does not mention failed index creation.

drh added on 2019-05-17 20:40:46: (text/x-fossil-wiki)
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.