/ Check-in [149ec24e]
Login

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

Overview
Comment:Add a test case for the affinity problem reported by ticket [93fb9f89d6].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 149ec24e61437fac2b0dd6239276d3aa543c56cb
User & Date: drh 2009-08-13 17:14:59
Context
2009-08-13
18:14
Enhancements to the whereB.test to check more affinity corner cases. check-in: 10484598 user: drh tags: trunk
17:14
Add a test case for the affinity problem reported by ticket [93fb9f89d6]. check-in: 149ec24e user: drh tags: trunk
15:42
Merge the accidental fork. check-in: 86a06dd0 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added test/whereB.test.









































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# 2009 August 13
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library. The
# focus of this file is testing WHERE clause conditions with
# subtle affinity issues.
#

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

do_test whereB-1.1 {
  db eval {
    CREATE TABLE t1(x,y);    -- affinity of t1.y is NONE
    INSERT INTO t1 VALUES(1,2);
    INSERT INTO t1 VALUES(2,7);

    CREATE TABLE t2(a, b TEXT);  -- affinity of t2.b is TEXT
    CREATE INDEX t2b ON t2(b);
    INSERT INTO t2 VALUES(11,2);
    INSERT INTO t2 VALUES(12,6);

    SELECT x, a, y=b FROM t1, t2 ORDER BY +x, +a;
  }
} {1 11 0 1 12 0 2 11 0 2 12 0}
do_test whereB-1.2 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE y=b ORDER BY +x, +a;
  }
} {}
do_test whereB-1.3 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE b=y ORDER BY +x, +a;
  }
} {}
do_test whereB-1.4 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE +y=+b ORDER BY +x, +a;
  }
} {}
do_test whereB-1.100 {
  db eval {
    DROP INDEX t2b;
    SELECT x, a, y=b FROM t1, t2 WHERE y=b ORDER BY +x, +a;
  }
} {}
do_test whereB-1.101 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE b=y ORDER BY +x, +a;
  }
} {}
do_test whereB-1.102 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE +y=+b ORDER BY +x, +a;
  }
} {}

do_test whereB-2.1 {
  db eval {
    DROP TABLE t1;
    DROP TABLE t2;

    CREATE TABLE t1(x,y);    -- affinity of t1.y is NONE
    INSERT INTO t1 VALUES(1,2);
    INSERT INTO t1 VALUES(2,7);

    CREATE TABLE t2(a, b UNKNOWN);  -- affinity of t2.b is NUMERIC
    CREATE INDEX t2b ON t2(b);
    INSERT INTO t2 VALUES(11,2);
    INSERT INTO t2 VALUES(12,6);

    SELECT x, a, y=b FROM t1, t2 ORDER BY +x, +a;
  }
} {1 11 1 1 12 0 2 11 0 2 12 0}
do_test whereB-2.2 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE y=b ORDER BY +x, +a;
  }
} {1 11 1}
do_test whereB-2.3 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE b=y ORDER BY +x, +a;
  }
} {1 11 1}
do_test whereB-2.4 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE +y=+b ORDER BY +x, +a;
  }
} {1 11 1}
do_test whereB-2.100 {
  db eval {
    DROP INDEX t2b;
    SELECT x, a, y=b FROM t1, t2 WHERE y=b ORDER BY +x, +a;
  }
} {1 11 1}
do_test whereB-2.101 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE b=y ORDER BY +x, +a;
  }
} {1 11 1}
do_test whereB-2.102 {
  db eval {
    SELECT x, a, y=b FROM t1, t2 WHERE +y=+b ORDER BY +x, +a;
  }
} {1 11 1}



finish_test