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

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

Issue 901033002: Import SQLite 3.8.7.4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Chromium changes to support SQLite 3.8.7.4. Created 5 years, 10 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
OLDNEW
1 # 2008 June 24 1 # 2008 June 24
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 cksort { SELECT a FROM v1 ORDER BY 1 LIMIT 5 } 408 cksort { SELECT a FROM v1 ORDER BY 1 LIMIT 5 }
409 } {1 2 3 4 5 sort} 409 } {1 2 3 4 5 sort}
410 do_test select9-4.X { 410 do_test select9-4.X {
411 execsql { 411 execsql {
412 DROP INDEX i1; 412 DROP INDEX i1;
413 DROP INDEX i2; 413 DROP INDEX i2;
414 DROP VIEW v1; 414 DROP VIEW v1;
415 } 415 }
416 } {} 416 } {}
417 417
418 # Testing to make sure that queries involving a view of a compound select
419 # are planned efficiently. This detects a problem reported on the mailing
420 # list on 2012-04-26. See
421 #
422 # http://www.mail-archive.com/sqlite-users%40sqlite.org/msg69746.html
423 #
424 # For additional information.
425 #
426 do_test select9-5.1 {
427 db eval {
428 CREATE TABLE t51(x, y);
429 CREATE TABLE t52(x, y);
430 CREATE VIEW v5 as
431 SELECT x, y FROM t51
432 UNION ALL
433 SELECT x, y FROM t52;
434 CREATE INDEX t51x ON t51(x);
435 CREATE INDEX t52x ON t52(x);
436 EXPLAIN QUERY PLAN
437 SELECT * FROM v5 WHERE x='12345' ORDER BY y;
438 }
439 } {~/SCAN TABLE/} ;# Uses indices with "*"
440 do_test select9-5.2 {
441 db eval {
442 EXPLAIN QUERY PLAN
443 SELECT x, y FROM v5 WHERE x='12345' ORDER BY y;
444 }
445 } {~/SCAN TABLE/} ;# Uses indices with "x, y"
446 do_test select9-5.3 {
447 db eval {
448 EXPLAIN QUERY PLAN
449 SELECT x, y FROM v5 WHERE +x='12345' ORDER BY y;
450 }
451 } {/SCAN TABLE/} ;# Full table scan if the "+x" prevents index usage.
452
453 # 2013-07-09: Ticket [490a4b7235624298]:
454 # "WHERE 0" on the first element of a UNION causes an assertion fault
455 #
456 do_execsql_test select9-6.1 {
457 CREATE TABLE t61(a);
458 CREATE TABLE t62(b);
459 INSERT INTO t61 VALUES(111);
460 INSERT INTO t62 VALUES(222);
461 SELECT a FROM t61 WHERE 0 UNION SELECT b FROM t62;
462 } {222}
463 do_execsql_test select9-6.2 {
464 SELECT a FROM t61 WHERE 0 UNION ALL SELECT b FROM t62;
465 } {222}
466 do_execsql_test select9-6.3 {
467 SELECT a FROM t61 UNION SELECT b FROM t62 WHERE 0;
468 } {111}
469
470
418 471
419 finish_test 472 finish_test
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698