SQLite

View Ticket
Login
Ticket Hash: 5a3dba81044213203047df25272ac99f25dd8017
Title: REINDEX causes "UNIQUE constraint failed" error
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-08-30 23:15:18
Version Found In: 3.29.0
User Comments:
mrigger added on 2019-08-30 19:41:46:

Consider the following test case:

CREATE TABLE t0(c0 REAL UNIQUE, c1);
CREATE UNIQUE INDEX i0 ON t0(0 || c1);
INSERT INTO t0(c0, c1) VALUES (1, 2),  (2, 1);
INSERT INTO t0(c0) VALUES (1) ON CONFLICT(c0) DO UPDATE SET c1=excluded.c0;
REINDEX; -- unexpected: UNIQUE constraint failed: index 'i0'

Unexpectedly, the REINDEX causes an error.