SQLite

View Ticket
Login
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.