aboutsummaryrefslogtreecommitdiff
path: root/test/where.test
diff options
context:
space:
mode:
authordanielk1977 <danielk1977@noemail.net>2008-11-03 09:06:05 +0000
committerdanielk1977 <danielk1977@noemail.net>2008-11-03 09:06:05 +0000
commit3072c5ea11634ad57d577352f46cea375057d5ce (patch)
tree1d8c7288be740578c963b0c3027c88cec3b75988 /test/where.test
parent2d16fb1d34a22e1d32a28a05c9fdb6760b80a9b4 (diff)
downloadsqlite-3072c5ea11634ad57d577352f46cea375057d5ce.tar.gz
sqlite-3072c5ea11634ad57d577352f46cea375057d5ce.zip
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
Diffstat (limited to 'test/where.test')
-rw-r--r--test/where.test44
1 files changed, 43 insertions, 1 deletions
diff --git a/test/where.test b/test/where.test
index 4437ff0a6..9145bcc75 100644
--- a/test/where.test
+++ b/test/where.test
@@ -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