SQLite

View Ticket
Login
2009-09-24
18:42 Fixed ticket [4a03edc4c8]: Index corruption following aggressive use of ON CONFLICT clause. plus 3 other changes (artifact: cd3aa8c601 user: drh)
00:09
Make sure a transaction is available for rollback whenever a REDUCE conflict resolution occurs and there is the possibility to ABORT. Ticket [4a03edc4c8c] (check-in: f0c56fa90d user: drh tags: trunk)
2009-09-23
19:16 New ticket [4a03edc4c8] Index corruption following aggressive use of ON CONFLICT clause.. (artifact: 360b463978 user: drh)

Ticket Hash: 4a03edc4c8c028c93e9269f64fc5e97f632c1166
Title: Index corruption following aggressive use of ON CONFLICT clause.
Status: Fixed Type: Code_Defect
Severity: Critical Priority: Immediate
Subsystem: Code_Generator Resolution: Fixed
Last Modified: 2009-09-24 18:42:02
15.79 years ago
Created: 2009-09-23 19:16:47
15.79 years ago
Version Found In: 3.6.18
Description:
The following SQL results in a database file that contains a corrupt index, as demonstrated by the "integrity_check" at the end:
    CREATE TABLE t1(
      a INTEGER PRIMARY KEY ON CONFLICT REPLACE,
      b UNIQUE ON CONFLICT FAIL
    );
    INSERT INTO t1 VALUES(1, 1);
    INSERT INTO t1 VALUES(2, 2);
    BEGIN;
      INSERT INTO t1 VALUES(1, 2);
    COMMIT;
    PRAGMA integrity_check;

The index corruption can be fixed by running the REINDEX command. This bug is present in all versions of SQLite going back at least to version 3.1.3 on 2005-02-19. (Version 3.1.3 is the oldest version that is readily at hand for testing.)


drh added on 2009-09-24 18:42:02:
Fixed in check-in [f0c56fa90dc95aff6fe6764b5ab75a90199247b0]