/ Check-in [e01f6ef9]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add further pseudo-randomly generated test cases to where8.test. (CVS 6083)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e01f6ef9d981d50a70c05edc4ef8135dbc473ba1
User & Date: danielk1977 2008-12-30 16:13:05
Context
2008-12-30
16:18
Get EXPLAIN QUERY PLAN working with the multi-index OR optimization. Added new test script "where9.test". (CVS 6084) check-in: 4b646022 user: drh tags: trunk
16:13
Add further pseudo-randomly generated test cases to where8.test. (CVS 6083) check-in: e01f6ef9 user: danielk1977 tags: trunk
15:51
Fix a bug in where8.test causing a tcl exception. (CVS 6082) check-in: 495b569a user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/where8.test.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
457
458
459
460
461
462
463



















































































































































































464
465
466
467
468
469
470
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus
# is testing of where.c. More specifically, the focus is the optimization
# of WHERE clauses that feature the OR operator.
#
# $Id: where8.test,v 1.4 2008/12/30 15:51:41 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Test organization:
#
#   where8-1.*: Tests to demonstrate simple cases work with a single table
................................................................................
15  { SELECT * FROM t3 WHERE c > 'one' OR c >= 'one' OR c LIKE 'one%' }
16  { SELECT * FROM t3 WHERE c > 'one' OR c = c OR c = a }
17  { SELECT * FROM t3 WHERE c IS NULL OR a >= 'peak' }
18  { SELECT * FROM t3 WHERE c IN ('other', 'all', 'snapshots') OR a>1 }
19  { SELECT * FROM t3 WHERE c IN ('other', 'all', 'snapshots') AND a>1 }
20  { SELECT * FROM t3 WHERE c IS NULL AND a>'one' }
21  { SELECT * FROM t3 WHERE c IS NULL OR a>'one' }




















































































































































































  } {
    do_test where8-4.$A.$B.1 {
      set R [execsql $sql]
      if {![info exists results($B)]} {
        set results($B) $R
      }







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The focus
# is testing of where.c. More specifically, the focus is the optimization
# of WHERE clauses that feature the OR operator.
#
# $Id: where8.test,v 1.5 2008/12/30 16:13:05 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Test organization:
#
#   where8-1.*: Tests to demonstrate simple cases work with a single table
................................................................................
15  { SELECT * FROM t3 WHERE c > 'one' OR c >= 'one' OR c LIKE 'one%' }
16  { SELECT * FROM t3 WHERE c > 'one' OR c = c OR c = a }
17  { SELECT * FROM t3 WHERE c IS NULL OR a >= 'peak' }
18  { SELECT * FROM t3 WHERE c IN ('other', 'all', 'snapshots') OR a>1 }
19  { SELECT * FROM t3 WHERE c IN ('other', 'all', 'snapshots') AND a>1 }
20  { SELECT * FROM t3 WHERE c IS NULL AND a>'one' }
21  { SELECT * FROM t3 WHERE c IS NULL OR a>'one' }
22  { SELECT * FROM t3 WHERE b = b AND a > 'are' }
23  { SELECT * FROM t3 WHERE c <= b OR b < 'snapshots' }
24  { SELECT * FROM t3 WHERE 'onlookers' >= c AND a <= b OR b = 'angle' }
25  { SELECT * FROM t3 WHERE b = 'from' }
26  { SELECT * FROM t3 WHERE b = 4543.266482 }
27  { SELECT * FROM t3 WHERE c < 3282306647 }
28  { SELECT * FROM t3 WHERE c IS NULL AND b >= c }
29  { SELECT * FROM t3 WHERE b > 0.4811174502 AND c = 'other' AND 'viewed' > a }
30  { SELECT * FROM t3 WHERE c = 'peak' }
31  { SELECT * FROM t3 WHERE c < 53594.08128 OR c <= b }
32  { SELECT * FROM t3 WHERE 'writings' <= b }
33  { SELECT * FROM t3 WHERE 2643383279 = b OR c < b AND b <= 3282306647 }
34  { SELECT * FROM t3 WHERE a IS NULL }
35  { SELECT * FROM t3 WHERE 'writings' = a OR b = 378678316.5 }
36  { SELECT * FROM t3 WHERE 'and' >= c }
37  { SELECT * FROM t3 WHERE c < 'from' }
38  { SELECT * FROM t3 WHERE 'his' < c OR b < b }
39  { SELECT * FROM t3 WHERE 53594.08128 = b AND c >= b }
40  { SELECT * FROM t3 WHERE 'unalike' < c AND 'are' >= c AND a <= b }
41  { SELECT * FROM t3 WHERE b >= 4543.266482 OR 'Alpine' > a OR 271.2019091 <= a }
42  { SELECT * FROM t3 WHERE b = c }
43  { SELECT * FROM t3 WHERE c > a AND b < 'all' }
44  { SELECT * FROM t3 WHERE c BETWEEN 'hills' AND 'snapshots' AND c <= 'the' OR c = a }
45  { SELECT * FROM t3 WHERE b > c AND c >= 'hills' }
46  { SELECT * FROM t3 WHERE b > 'or' OR a <= 'hills' OR c IS NULL }
47  { SELECT * FROM t3 WHERE c > b OR b BETWEEN 1339.360726 AND 'onlookers' OR 1415926535 >= b }
48  { SELECT * FROM t3 WHERE a IS NULL }
49  { SELECT * FROM t3 WHERE a > 'other' }
50  { SELECT * FROM t3 WHERE 'the' <= c AND a <= c }
51  { SELECT * FROM t3 WHERE 346.0348610 = a AND c = b }
52  { SELECT * FROM t3 WHERE c BETWEEN 50.58223172 AND 'same' AND a < b }
53  { SELECT * FROM t3 WHERE 'Alpine' <= b AND c >= 'angle' OR b <= 271.2019091 }
54  { SELECT * FROM t3 WHERE a < a AND 1415926535 > b }
55  { SELECT * FROM t3 WHERE c > a AND 'have' >= c }
56  { SELECT * FROM t3 WHERE b <= b AND c > b }
57  { SELECT * FROM t3 WHERE a IS NULL AND c <= c }
58  { SELECT * FROM t3 WHERE b < c OR b = c }
59  { SELECT * FROM t3 WHERE c < b AND b >= 'it' }
60  { SELECT * FROM t3 WHERE a = b AND a <= b OR b >= a }
61  { SELECT * FROM t3 WHERE b = c }
62  { SELECT * FROM t3 WHERE c BETWEEN 'the' AND 271.2019091 OR c <= 3282306647 AND c >= b }
63  { SELECT * FROM t3 WHERE c >= c AND c < 'writings' }
64  { SELECT * FROM t3 WHERE c <= 3282306647 AND b > a OR 'unalike' <= a }
65  { SELECT * FROM t3 WHERE a > c }
66  { SELECT * FROM t3 WHERE c = 'it' OR b >= b }
67  { SELECT * FROM t3 WHERE c = a OR b < c }
68  { SELECT * FROM t3 WHERE b > a }
69  { SELECT * FROM t3 WHERE a < b OR a > 4543.266482 OR 'same' = b }
70  { SELECT * FROM t3 WHERE c < c OR b <= c OR a <= b }
71  { SELECT * FROM t3 WHERE c > a }
72  { SELECT * FROM t3 WHERE c > b }
73  { SELECT * FROM t3 WHERE b <= a }
74  { SELECT * FROM t3 WHERE 3282306647 < b AND a >= 'or' OR a >= 378678316.5 }
75  { SELECT * FROM t3 WHERE 50.58223172 <= c OR c = c AND b < b }
76  { SELECT * FROM t3 WHERE 'and' < b OR b < c OR c > 1339.360726 }
77  { SELECT * FROM t3 WHERE b <= c }
78  { SELECT * FROM t3 WHERE 'in' <= c }
79  { SELECT * FROM t3 WHERE c <= b AND a > a AND c < b }
80  { SELECT * FROM t3 WHERE 'over' < b }
81  { SELECT * FROM t3 WHERE b >= b OR b < c OR a < b }
82  { SELECT * FROM t3 WHERE 'towering' <= b OR 'towering' = a AND c > b }
83  { SELECT * FROM t3 WHERE 'peak' = a OR b BETWEEN 2643383279 AND 'the' }
84  { SELECT * FROM t3 WHERE 'an' < c AND c > 'the' AND c IS NULL }
85  { SELECT * FROM t3 WHERE a <= 'sometimes' AND a BETWEEN 'unalike' AND 1339.360726 }
86  { SELECT * FROM t3 WHERE 1339.360726 < c AND c IS NULL }
87  { SELECT * FROM t3 WHERE b > 'the' }
88  { SELECT * FROM t3 WHERE 'and' = a }
89  { SELECT * FROM t3 WHERE b >= b }
90  { SELECT * FROM t3 WHERE b >= 8979323846 }
91  { SELECT * FROM t3 WHERE c <= a }
92  { SELECT * FROM t3 WHERE a BETWEEN 'have' AND 'light' OR a > b OR a >= 378678316.5 }
93  { SELECT * FROM t3 WHERE c > 3282306647 }
94  { SELECT * FROM t3 WHERE b > c }
95  { SELECT * FROM t3 WHERE b >= a AND 'villages' > a AND b >= c }
96  { SELECT * FROM t3 WHERE 'angle' > a }
97  { SELECT * FROM t3 WHERE 'paintings' >= a }
98  { SELECT * FROM t3 WHERE 'or' >= c }
99  { SELECT * FROM t3 WHERE c < b }


101  { SELECT * FROM t3, t4 WHERE f < 'sometimes' OR 'over' <= g AND h < 1415926535 }
102  { SELECT * FROM t3, t4 WHERE h >= 'from' AND h < 6939937510 OR g > h }
103  { SELECT * FROM t3, t4 WHERE c <= h AND g = h AND c >= 'all' }
104  { SELECT * FROM t3, t4 WHERE c = a }
105  { SELECT * FROM t3, t4 WHERE 'of' >= h }
106  { SELECT * FROM t3, t4 WHERE f >= b AND a < g AND h < 'and' }
107  { SELECT * FROM t3, t4 WHERE f <= 8628034825 AND 0938446095 >= b }
108  { SELECT * FROM t3, t4 WHERE a < 'the' }
109  { SELECT * FROM t3, t4 WHERE f = 'sometimes' OR b < 'of' }
110  { SELECT * FROM t3, t4 WHERE c IS NULL }
111  { SELECT * FROM t3, t4 WHERE 'have' = b OR g <= 346.0348610 }
112  { SELECT * FROM t3, t4 WHERE f > b AND b <= h }
113  { SELECT * FROM t3, t4 WHERE f > c OR 'the' = a OR 50.58223172 = a }
114  { SELECT * FROM t3, t4 WHERE 2643383279 <= a AND c = a }
115  { SELECT * FROM t3, t4 WHERE h >= b AND 'it' <= b }
116  { SELECT * FROM t3, t4 WHERE g BETWEEN 'from' AND 'peak' }
117  { SELECT * FROM t3, t4 WHERE 'their' > a AND g > b AND f <= c }
118  { SELECT * FROM t3, t4 WHERE h = 5028841971 AND 'unalike' <= f }
119  { SELECT * FROM t3, t4 WHERE c IS NULL AND a = 3282306647 OR a <= 'Alpine' }
120  { SELECT * FROM t3, t4 WHERE 'sometimes' <= f OR 8214808651 >= a AND b <= 53594.08128 }
121  { SELECT * FROM t3, t4 WHERE 6939937510 <= f OR c < f OR 'sometimes' = c }
122  { SELECT * FROM t3, t4 WHERE b < 'onlookers' AND 'paintings' = g AND c <= h }
123  { SELECT * FROM t3, t4 WHERE a BETWEEN 'all' AND 'from' OR c > 346.0348610 }
124  { SELECT * FROM t3, t4 WHERE 'from' <= b OR a BETWEEN 53594.08128 AND 'their' AND c > a }
125  { SELECT * FROM t3, t4 WHERE h = 2643383279 }
126  { SELECT * FROM t3, t4 WHERE a <= 'the' }
127  { SELECT * FROM t3, t4 WHERE h <= c }
128  { SELECT * FROM t3, t4 WHERE g <= 346.0348610 AND 66.59334461 >= f AND f <= f }
129  { SELECT * FROM t3, t4 WHERE g >= c OR 'in' < b OR b > g }
130  { SELECT * FROM t3, t4 WHERE 'over' > g AND b BETWEEN 'unalike' AND 'remarkably' }
131  { SELECT * FROM t3, t4 WHERE h <= 2847564.823 }
132  { SELECT * FROM t3, t4 WHERE h <= 'remarkably' AND 4543.266482 > h }
133  { SELECT * FROM t3, t4 WHERE a >= c AND 'it' > g AND c < c }
134  { SELECT * FROM t3, t4 WHERE h <= 66.59334461 AND b > 3421170679 }
135  { SELECT * FROM t3, t4 WHERE h < 'are' OR f BETWEEN 0938446095 AND 'are' OR b = b }
136  { SELECT * FROM t3, t4 WHERE h = a OR 66.59334461 <= f }
137  { SELECT * FROM t3, t4 WHERE f > 'of' OR h <= h OR a = f }
138  { SELECT * FROM t3, t4 WHERE 'other' >= g }
139  { SELECT * FROM t3, t4 WHERE b <= 3421170679 }
140  { SELECT * FROM t3, t4 WHERE 'all' = f AND 4543.266482 = b OR f BETWEEN 'and' AND 'angle' }
141  { SELECT * FROM t3, t4 WHERE 'light' = f OR h BETWEEN 'remarkably' AND 1415926535 }
142  { SELECT * FROM t3, t4 WHERE 'hills' = f OR 'the' >= f }
143  { SELECT * FROM t3, t4 WHERE a > 346.0348610 }
144  { SELECT * FROM t3, t4 WHERE 5028841971 = h }
145  { SELECT * FROM t3, t4 WHERE b >= c AND 'the' >= g OR 45.64856692 <= g }
146  { SELECT * FROM t3, t4 WHERE c < 5028841971 }
147  { SELECT * FROM t3, t4 WHERE a > a }
148  { SELECT * FROM t3, t4 WHERE c = 'snapshots' }
149  { SELECT * FROM t3, t4 WHERE h > 1339.360726 AND 'and' > c }
150  { SELECT * FROM t3, t4 WHERE 'and' > g OR 'sometimes' = c }
151  { SELECT * FROM t3, t4 WHERE g >= 'the' AND b >= 'onlookers' }
152  { SELECT * FROM t3, t4 WHERE h BETWEEN 'other' AND 2643383279 }
153  { SELECT * FROM t3, t4 WHERE 'it' = b }
154  { SELECT * FROM t3, t4 WHERE f = c OR c BETWEEN 'and' AND 0.4811174502 }
155  { SELECT * FROM t3, t4 WHERE b <= 'sometimes' OR c <= 0938446095 }
156  { SELECT * FROM t3, t4 WHERE 'and' <= b }
157  { SELECT * FROM t3, t4 WHERE g > a AND f = 'the' AND b < a }
158  { SELECT * FROM t3, t4 WHERE a < 'an' }
159  { SELECT * FROM t3, t4 WHERE a BETWEEN 'his' AND 'same' OR 8628034825 > f }
160  { SELECT * FROM t3, t4 WHERE b = 'peak' }
161  { SELECT * FROM t3, t4 WHERE f IS NULL AND a >= h }
162  { SELECT * FROM t3, t4 WHERE a IS NULL OR 2643383279 = c }
163  { SELECT * FROM t3, t4 WHERE b >= 5028841971 AND f < c AND a IS NULL }
164  { SELECT * FROM t3, t4 WHERE a >= g }
165  { SELECT * FROM t3, t4 WHERE c IS NULL }
166  { SELECT * FROM t3, t4 WHERE h >= h }
167  { SELECT * FROM t3, t4 WHERE 'over' <= h }
168  { SELECT * FROM t3, t4 WHERE b < 4543.266482 OR b = 2643383279 OR 8628034825 < b }
169  { SELECT * FROM t3, t4 WHERE g >= 6939937510 }
170  { SELECT * FROM t3, t4 WHERE 'or' < a OR b < g }
171  { SELECT * FROM t3, t4 WHERE h < 'hills' OR 'and' > g }
172  { SELECT * FROM t3, t4 WHERE 'from' > f OR f <= f }
173  { SELECT * FROM t3, t4 WHERE 'viewed' > b AND f < c }
174  { SELECT * FROM t3, t4 WHERE 'of' <= a }
175  { SELECT * FROM t3, t4 WHERE f > 0938446095 }
176  { SELECT * FROM t3, t4 WHERE a = g }
177  { SELECT * FROM t3, t4 WHERE g >= b AND f BETWEEN 'peak' AND 'and' }
178  { SELECT * FROM t3, t4 WHERE g = a AND 'it' > f }
179  { SELECT * FROM t3, t4 WHERE a <= b OR 'from' > f }
180  { SELECT * FROM t3, t4 WHERE f < 'and' }
181  { SELECT * FROM t3, t4 WHERE 6939937510 < b OR 'sometimes' < h }
182  { SELECT * FROM t3, t4 WHERE f > g AND f < 'peak' }
183  { SELECT * FROM t3, t4 WHERE a <= 53594.08128 AND c <= f AND f >= c }
184  { SELECT * FROM t3, t4 WHERE f = c OR 'it' > b OR g BETWEEN 'the' AND 'all' }
185  { SELECT * FROM t3, t4 WHERE c <= g OR a = h }
186  { SELECT * FROM t3, t4 WHERE 'same' = b OR c >= 2643383279 }
187  { SELECT * FROM t3, t4 WHERE h <= g OR c > 66.59334461 OR a <= f }
188  { SELECT * FROM t3, t4 WHERE b < c AND f = 'writings' }
189  { SELECT * FROM t3, t4 WHERE b < a }
190  { SELECT * FROM t3, t4 WHERE c >= f OR c = 'and' }
191  { SELECT * FROM t3, t4 WHERE f >= 'peak' AND g > f AND h > g }
192  { SELECT * FROM t3, t4 WHERE a >= 8979323846 AND 'same' > b OR c = 'and' }
193  { SELECT * FROM t3, t4 WHERE c >= g OR 'writings' >= c AND b = 'all' }
194  { SELECT * FROM t3, t4 WHERE 'remarkably' < g }
195  { SELECT * FROM t3, t4 WHERE a BETWEEN 'or' AND 'paintings' AND g <= f }
196  { SELECT * FROM t3, t4 WHERE 0938446095 > b OR g <= a OR h > b }
197  { SELECT * FROM t3, t4 WHERE g = 2643383279 AND f = g }
198  { SELECT * FROM t3, t4 WHERE g < 8979323846 }
199  { SELECT * FROM t3, t4 WHERE 'are' <= b }

  } {
    do_test where8-4.$A.$B.1 {
      set R [execsql $sql]
      if {![info exists results($B)]} {
        set results($B) $R
      }