This bug was originally found on a version of sqlite3 (tested in 3.5.9
and 3.7.11) in Android (2.2.1 and 4.1.2 respectively), but I've been
able to recreate it on sqlite3 3.7.13 from Debian/wheezy.

Test case:

CREATE TABLE t1(a,b,c);
INSERT INTO t1 VALUES(1,2,3), (4,5,6);
CREATE TABLE t2(d,e,f);
INSERT INTO t2 VALUES(3,6,9), (4,8,12);

# This works as expected
SELECT * FROM (SELECT a AS x, b AS y FROM t1 UNION ALL SELECT d AS x, e
AS y FROM t2);
#1|2
#4|5
#3|6
#4|8

# this doesn't crash...
SELECT * FROM (SELECT a AS x, b AS y FROM t1 UNION ALL SELECT d AS x, e
AS y, f AS z FROM t2);
#1|2
#4|5
#3|6
#4|8

# but this causes a segfault (it's missing column "y" from the second
inner SELECT):
SELECT * FROM (SELECT a AS x, b AS y FROM t1 UNION ALL SELECT d AS x
FROM t2);

-- 
Steve Pomeroy
MIT Mobile Experience Lab
http://mobile.mit.edu/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to