SQLite

View Ticket
Login
Ticket Hash: b9befa4b83a660cc34096fa3f967b128d947bbfc
Title: Segfault in table with generated column and foreign key
Status: Fixed Type: Code_Defect
Severity: Minor Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-10-31 20:58:06
Version Found In: 3.30.0
User Comments:
mrigger added on 2019-10-31 20:02:28: (text/x-fossil-wiki)
With the following test case, I can reliably reproduce a segfault on my machine:

<pre>
CREATE TABLE t0(c0, c1, c2 AS(1), PRIMARY KEY(c0) FOREIGN KEY(c2) REFERENCES t0);
CREATE VIRTUAL TABLE vt0 USING fts4;
CREATE INDEX i0 ON t0(c2, 0 BETWEEN '' AND c1 COLLATE BINARY, CASE '' WHEN c3 THEN 0 WHEN 0 THEN 0 WHEN '' THEN 0 WHEN 0 THEN c0 ELSE c1 END);
INSERT INTO t0 VALUES (0, 0), ('', 0);
PRAGMA foreign_keys = true;
ANALYZE;
UPDATE t0 SET c1 = c0; -- unexpected: Segmentation fault
</pre>