SQLite

View Ticket
Login
2016-10-03
02:59 Fixed ticket [7b332808]: AUTOINCREMENT problem with the INSERT xfer optimization plus 5 other changes (artifact: 509f81f3 user: drh)
02:59
Make sure the sqlite_sequence table is updated when an optional xfer optimization is used. Fix for ticket [7b3328086a5c1]. (check-in: 81e4d4f8 user: drh tags: trunk)
02:01 New ticket [7b332808] AUTOINCREMENT problem with the INSERT xfer optimization. (artifact: 5a826871 user: drh)

Ticket Hash: 7b3328086a5c116c39f5028d6b338625b9cc9661
Title: AUTOINCREMENT problem with the INSERT xfer optimization
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2016-10-03 02:59:42
Version Found In: 3.14.2
User Comments:
drh added on 2016-10-03 02:01:43:

The sqlite_sequence entry for table t2 is not initialized by the final INSERT in the following SQL:

CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b UNIQUE);
INSERT INTO t1 VALUES(888,9999);
CREATE TABLE t2(x INTEGER PRIMARY KEY AUTOINCREMENT, y UNIQUE);
INSERT INTO t2 SELECT * FROM t1;
SELECT * FROM sqlite_sequence;

Bisecting shows that the problem was introduced on on 2009-06-23 by check-in [1330993de8] and first appeared in version 3.6.16.

This problem was reported on the mailing list by Clemens Ladisch.