Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/sqlite/src/test/index6.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/sqlite/src/test/index5.test ('k') | third_party/sqlite/src/test/index7.test » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 2013-07-31 1 # 2013-07-31
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 SELECT * FROM t6; 260 SELECT * FROM t6;
261 } {123 456} 261 } {123 456}
262 do_execsql_test index6-6.1 { 262 do_execsql_test index6-6.1 {
263 UPDATE OR REPLACE t6 SET b=789; 263 UPDATE OR REPLACE t6 SET b=789;
264 SELECT * FROM t6; 264 SELECT * FROM t6;
265 } {123 789} 265 } {123 789}
266 do_execsql_test index6-6.2 { 266 do_execsql_test index6-6.2 {
267 PRAGMA integrity_check; 267 PRAGMA integrity_check;
268 } {ok} 268 } {ok}
269 269
270 # Test case for ticket [2326c258d02ead33d69faa63de8f4686b9b1b9d9] on
271 # 2015-02-24. Any use of a partial index qualifying constraint inside
272 # the ON clause of a LEFT JOIN was causing incorrect results for all
273 # versions of SQLite 3.8.0 through 3.8.8.
274 #
275 do_execsql_test index6-7.0 {
276 CREATE TABLE t7a(x);
277 CREATE TABLE t7b(y);
278 INSERT INTO t7a(x) VALUES(1);
279 CREATE INDEX t7ax ON t7a(x) WHERE x=99;
280 PRAGMA automatic_index=OFF;
281 SELECT * FROM t7a LEFT JOIN t7b ON (x=99) ORDER BY x;
282 } {1 {}}
283 do_execsql_test index6-7.1 {
284 INSERT INTO t7b(y) VALUES(2);
285 SELECT * FROM t7a JOIN t7b ON (x=99) ORDER BY x;
286 } {}
287 do_execsql_test index6-7.2 {
288 INSERT INTO t7a(x) VALUES(99);
289 SELECT * FROM t7a LEFT JOIN t7b ON (x=99) ORDER BY x;
290 } {1 {} 99 2}
291 do_execsql_test index6-7.3 {
292 SELECT * FROM t7a JOIN t7b ON (x=99) ORDER BY x;
293 } {99 2}
294 do_execsql_test index6-7.4 {
295 EXPLAIN QUERY PLAN
296 SELECT * FROM t7a JOIN t7b ON (x=99) ORDER BY x;
297 } {/USING COVERING INDEX t7ax/}
298
299
300 do_execsql_test index6-8.0 {
301 CREATE TABLE t8a(a,b);
302 CREATE TABLE t8b(x,y);
303 CREATE INDEX i8c ON t8b(y) WHERE x = 'value';
304
305 INSERT INTO t8a VALUES(1, 'one');
306 INSERT INTO t8a VALUES(2, 'two');
307 INSERT INTO t8a VALUES(3, 'three');
308
309 INSERT INTO t8b VALUES('value', 1);
310 INSERT INTO t8b VALUES('dummy', 2);
311 INSERT INTO t8b VALUES('value', 3);
312 INSERT INTO t8b VALUES('dummy', 4);
313 } {}
314
315 do_eqp_test index6-8.1 {
316 SELECT * FROM t8a LEFT JOIN t8b ON (x = 'value' AND y = a)
317 } {
318 0 0 0 {SCAN TABLE t8a}
319 0 1 1 {SEARCH TABLE t8b USING INDEX i8c (y=?)}
320 }
321
322 do_execsql_test index6-8.2 {
323 SELECT * FROM t8a LEFT JOIN t8b ON (x = 'value' AND y = a)
324 } {
325 1 one value 1
326 2 two {} {}
327 3 three value 3
328 }
329
330 # 2015-06-11. Assertion fault found by AFL
331 #
332 do_execsql_test index6-9.1 {
333 CREATE TABLE t9(a int, b int, c int);
334 CREATE INDEX t9ca ON t9(c,a) WHERE a in (10,12,20);
335 INSERT INTO t9 VALUES(1,1,9),(10,2,35),(11,15,82),(20,19,5),(NULL,7,3);
336 UPDATE t9 SET b=c WHERE a in (10,12,20);
337 SELECT a,b,c,'|' FROM t9 ORDER BY a;
338 } {{} 7 3 | 1 1 9 | 10 35 35 | 11 15 82 | 20 5 5 |}
339 do_execsql_test index6-9.2 {
340 DROP TABLE t9;
341 CREATE TABLE t9(a int, b int, c int, PRIMARY KEY(a)) WITHOUT ROWID;
342 CREATE INDEX t9ca ON t9(c,a) WHERE a in (10,12,20);
343 INSERT INTO t9 VALUES(1,1,9),(10,2,35),(11,15,82),(20,19,5);
344 UPDATE t9 SET b=c WHERE a in (10,12,20);
345 SELECT a,b,c,'|' FROM t9 ORDER BY a;
346 } {1 1 9 | 10 35 35 | 11 15 82 | 20 5 5 |}
347
348 # AND-connected terms in the WHERE clause of a partial index
349 #
350 do_execsql_test index6-10.1 {
351 CREATE TABLE t10(a,b,c,d,e INTEGER PRIMARY KEY);
352 INSERT INTO t10 VALUES
353 (1,2,3,4,5),
354 (2,3,4,5,6),
355 (3,4,5,6,7),
356 (1,2,3,8,9);
357 CREATE INDEX t10x ON t10(d) WHERE a=1 AND b=2 AND c=3;
358 SELECT e FROM t10 WHERE a=1 AND b=2 AND c=3 ORDER BY d;
359 } {5 9}
360 do_execsql_test index6-10.1eqp {
361 EXPLAIN QUERY PLAN
362 SELECT e FROM t10 WHERE a=1 AND b=2 AND c=3 ORDER BY d;
363 } {/USING INDEX t10x/}
364 do_execsql_test index6-10.2 {
365 SELECT e FROM t10 WHERE c=3 AND 2=b AND a=1 ORDER BY d DESC;
366 } {9 5}
367 do_execsql_test index6-10.2eqp {
368 EXPLAIN QUERY PLAN
369 SELECT e FROM t10 WHERE c=3 AND 2=b AND a=1 ORDER BY d DESC;
370 } {/USING INDEX t10x/}
371 do_execsql_test index6-10.3 {
372 SELECT e FROM t10 WHERE a=1 AND b=2 ORDER BY d DESC;
373 } {9 5}
374 do_execsql_test index6-10.3eqp {
375 EXPLAIN QUERY PLAN
376 SELECT e FROM t10 WHERE a=1 AND b=2 ORDER BY d DESC;
377 } {~/USING INDEX t10x/}
270 378
271 finish_test 379 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/index5.test ('k') | third_party/sqlite/src/test/index7.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698