Fix a bug reported on the mailing list triggered by the pattern "SELECT <col>, (SELECT ... FROM tbl WHERE rowid > <col>) FROM ...". (CVS 5855)

FossilOrigin-Name: 6c918c4eb9362ebfdbe0486515679102b2862970
This commit is contained in:
danielk1977
2008-11-03 09:06:05 +00:00
parent 2d16fb1d34
commit 3072c5ea11
4 changed files with 66 additions and 14 deletions
+43 -1
View File
@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the use of indices in WHERE clases.
#
# $Id: where.test,v 1.49 2008/10/07 23:46:38 drh Exp $
# $Id: where.test,v 1.50 2008/11/03 09:06:06 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -1215,4 +1215,46 @@ do_test where-16.4 {
integrity_check {where-99.0}
#---------------------------------------------------------------------
# These tests test that a bug surrounding the use of ForceInt has been
# fixed in where.c.
#
do_test where-17.1 {
execsql {
CREATE TABLE tbooking (
id INTEGER PRIMARY KEY,
eventtype INTEGER NOT NULL
);
INSERT INTO tbooking VALUES(42, 3);
INSERT INTO tbooking VALUES(43, 4);
}
} {}
do_test where-17.2 {
execsql {
SELECT a.id
FROM tbooking AS a
WHERE a.eventtype=3;
}
} {42}
do_test where-17.3 {
execsql {
SELECT a.id, (SELECT b.id FROM tbooking AS b WHERE b.id>a.id)
FROM tbooking AS a
WHERE a.eventtype=3;
}
} {42 43}
do_test where-17.4 {
execsql {
SELECT a.id, (SELECT b.id FROM tbooking AS b WHERE b.id>a.id)
FROM (SELECT 1.5 AS id) AS a
}
} {1.5 42}
do_test where-17.5 {
execsql {
CREATE TABLE tother(a, b);
INSERT INTO tother VALUES(1, 3.7);
SELECT id, a FROM tbooking, tother WHERE id>a;
}
} {42 1 43 1}
finish_test