OLD | NEW |
1 # 2015-03-12 | 1 # 2015-03-12 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 proc dstr {} { return [string repeat x 1100000] } | 113 proc dstr {} { return [string repeat x 1100000] } |
114 db func dstr -deterministic dstr | 114 db func dstr -deterministic dstr |
115 do_catchsql_test 4.3 { | 115 do_catchsql_test 4.3 { |
116 SELECT * FROM t1 WHERE x = dstr() AND y = 11; | 116 SELECT * FROM t1 WHERE x = dstr() AND y = 11; |
117 } {1 {string or blob too big}} | 117 } {1 {string or blob too big}} |
118 | 118 |
119 do_catchsql_test 4.4 { | 119 do_catchsql_test 4.4 { |
120 SELECT * FROM t1 WHERE x = test_zeroblob(1100000) AND y = 4; | 120 SELECT * FROM t1 WHERE x = test_zeroblob(1100000) AND y = 4; |
121 } {1 {string or blob too big}} | 121 } {1 {string or blob too big}} |
122 | 122 |
| 123 # 2016-12-08: Constraints of the form "x=? AND x IS NOT NULL" were being |
| 124 # mishandled. The sqlite3Stat4ProbeSetValue() routine was assuming that |
| 125 # valueNew() was returning a Mem object that was preset to NULL, which is |
| 126 # not the case. The consequence was the the "x IS NOT NULL" constraint |
| 127 # was used to drive the index (via the "x>NULL" pseudo-constraint) rather |
| 128 # than the "x=?" constraint. |
| 129 # |
| 130 do_execsql_test 5.1 { |
| 131 DROP TABLE IF EXISTS t1; |
| 132 CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT, c INT); |
| 133 WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<10000) |
| 134 INSERT INTO t1(a, c) SELECT x, x FROM c; |
| 135 UPDATE t1 SET b=printf('x%02x',a/500) WHERE a>4000; |
| 136 UPDATE t1 SET b='xyz' where a>=9998; |
| 137 CREATE INDEX t1b ON t1(b); |
| 138 ANALYZE; |
| 139 SELECT count(*), b FROM t1 GROUP BY 2 ORDER BY 2; |
| 140 } {4000 {} 499 x08 500 x09 500 x0a 500 x0b 500 x0c 500 x0d 500 x0e 500 x0f 500 x
10 500 x11 500 x12 498 x13 3 xyz} |
| 141 do_execsql_test 5.2 { |
| 142 explain query plan |
| 143 SELECT * FROM t1 WHERE b='xyz' AND b IS NOT NULL ORDER BY +a; |
| 144 /* v---- Should be "=", not ">" */ |
| 145 } {/USING INDEX t1b .b=/} |
| 146 do_execsql_test 5.3 { |
| 147 SELECT * FROM t1 WHERE b='xyz' AND b IS NOT NULL ORDER BY +a; |
| 148 } {9998 xyz 9998 9999 xyz 9999 10000 xyz 10000} |
123 | 149 |
124 finish_test | 150 finish_test |
OLD | NEW |