SQLite

View Ticket
Login
Ticket Hash: da7841375186386c545ee39b8506ee4aaef43b60
Title: Query flattening causes bad byte-code for a vector IN operator
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2016-11-23 23:59:54
8.63 years ago
Created: 2016-11-17 05:51:51
8.65 years ago
Version Found In: 3.15.1
User Comments:
drh added on 2016-11-17 05:51:51:

The following SQL results in a segfault due to an attempt to access a non-existent cursor:

REATE TABLE T1(a TEXT);
INSERT INTO T1(a) VALUES ('aaa');
CREATE TABLE T2(a TEXT PRIMARY KEY,n INT UNIQUE);
INSERT INTO T2(a, n) VALUES('aaa',0);
SELECT * FROM T2
WHERE (a,n) IN (SELECT T1.a, V.n FROM T1 JOIN (SELECT * FROM (SELECT 0 n)) V);

The problem might be caused by query flattening on the V table of the join on the RHS of the vector IN operator, but this is not a definitive diagnosis.