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

Side by Side Diff: third_party/sqlite/src/test/orderby1.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/offset1.test ('k') | third_party/sqlite/src/test/orderby8.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 # 2012 Sept 27 1 # 2012 Sept 27
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 # 456 #
457 do_execsql_test 5.0 { 457 do_execsql_test 5.0 {
458 EXPLAIN QUERY PLAN SELECT 5 ORDER BY 1 458 EXPLAIN QUERY PLAN SELECT 5 ORDER BY 1
459 } {} 459 } {}
460 do_execsql_test 5.1 { 460 do_execsql_test 5.1 {
461 EXPLAIN QUERY PLAN SELECT 5 UNION ALL SELECT 3 ORDER BY 1 461 EXPLAIN QUERY PLAN SELECT 5 UNION ALL SELECT 3 ORDER BY 1
462 } {~/B-TREE/} 462 } {~/B-TREE/}
463 do_execsql_test 5.2 { 463 do_execsql_test 5.2 {
464 SELECT 5 UNION ALL SELECT 3 ORDER BY 1 464 SELECT 5 UNION ALL SELECT 3 ORDER BY 1
465 } {3 5} 465 } {3 5}
466 do_execsql_test 5.3 {
467 SELECT 986 AS x GROUP BY X ORDER BY X
468 } {986}
466 469
467 # The following test (originally derived from a single test within fuzz.test) 470 # The following test (originally derived from a single test within fuzz.test)
468 # verifies that a PseudoTable cursor is not closed prematurely in a deeply 471 # verifies that a PseudoTable cursor is not closed prematurely in a deeply
469 # nested query. This test caused a segfault on 3.8.5 beta. 472 # nested query. This test caused a segfault on 3.8.5 beta.
470 # 473 #
471 do_execsql_test 6.0 { 474 do_execsql_test 6.0 {
472 CREATE TABLE abc(a, b, c); 475 CREATE TABLE abc(a, b, c);
473 INSERT INTO abc VALUES(1, 2, 3); 476 INSERT INTO abc VALUES(1, 2, 3);
474 INSERT INTO abc VALUES(4, 5, 6); 477 INSERT INTO abc VALUES(4, 5, 6);
475 INSERT INTO abc VALUES(7, 8, 9); 478 INSERT INTO abc VALUES(7, 8, 9);
(...skipping 12 matching lines...) Expand all
488 # routine in where.c. 491 # routine in where.c.
489 # 492 #
490 do_execsql_test 7.0 { 493 do_execsql_test 7.0 {
491 CREATE TABLE t7(a,b); 494 CREATE TABLE t7(a,b);
492 CREATE INDEX t7a ON t7(a); 495 CREATE INDEX t7a ON t7(a);
493 CREATE INDEX t7ab ON t7(a,b); 496 CREATE INDEX t7ab ON t7(a,b);
494 EXPLAIN QUERY PLAN 497 EXPLAIN QUERY PLAN
495 SELECT * FROM t7 WHERE a=?1 ORDER BY rowid; 498 SELECT * FROM t7 WHERE a=?1 ORDER BY rowid;
496 } {~/ORDER BY/} 499 } {~/ORDER BY/}
497 500
501 #-------------------------------------------------------------------------
502 # Test a partial sort large enough to cause the sorter to spill data
503 # to disk.
504 #
505 reset_db
506 do_execsql_test 8.0 {
507 PRAGMA cache_size = 5;
508 CREATE TABLE t1(a, b);
509 CREATE INDEX i1 ON t1(a);
510 }
511
512 do_eqp_test 8.1 {
513 SELECT * FROM t1 ORDER BY a, b;
514 } {
515 0 0 0 {SCAN TABLE t1 USING INDEX i1}
516 0 0 0 {USE TEMP B-TREE FOR RIGHT PART OF ORDER BY}
517 }
518
519 do_execsql_test 8.2 {
520 WITH cnt(i) AS (
521 SELECT 1 UNION ALL SELECT i+1 FROM cnt WHERE i<10000
522 )
523 INSERT INTO t1 SELECT i%2, randomblob(500) FROM cnt;
524 }
525
526 do_test 8.3 {
527 db eval { SELECT * FROM t1 ORDER BY a, b } { incr res $a }
528 set res
529 } 5000
530
531 #---------------------------------------------------------------------------
532 # https://www.sqlite.org/src/tktview/cb3aa0641d9a413841c004293a4fc06cdc122029
533 #
534 # Adverse interaction between scalar subqueries and the partial-sorting
535 # logic.
536 #
537 do_execsql_test 9.0 {
538 DROP TABLE IF EXISTS t1;
539 CREATE TABLE t1(x INTEGER PRIMARY KEY);
540 INSERT INTO t1 VALUES(1),(2);
541 DROP TABLE IF EXISTS t2;
542 CREATE TABLE t2(y);
543 INSERT INTO t2 VALUES(9),(8),(3),(4);
544 SELECT (SELECT x||y FROM t2, t1 ORDER BY x, y);
545 } {13}
546
498 547
499 finish_test 548 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/offset1.test ('k') | third_party/sqlite/src/test/orderby8.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698