Chromium Code Reviews

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

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « third_party/sqlite/src/test/select4.test ('k') | third_party/sqlite/src/test/select7.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 # 2001 September 15 1 # 2001 September 15
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 #***********************************************************************
11 # This file implements regression tests for SQLite library. The 11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing SELECT statements that contain 12 # focus of this file is testing SELECT statements that contain
13 # subqueries in their FROM clause. 13 # subqueries in their FROM clause.
14 # 14 #
15 # $Id: select6.test,v 1.29 2009/01/09 01:12:28 drh Exp $ 15 # $Id: select6.test,v 1.29 2009/01/09 01:12:28 drh Exp $
16 16
17 set testdir [file dirname $argv0] 17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl 18 source $testdir/tester.tcl
19 19
20 # Omit this whole file if the library is build without subquery support. 20 # Omit this whole file if the library is build without subquery support.
21 ifcapable !subquery { 21 ifcapable !subquery {
22 finish_test 22 finish_test
23 return 23 return
24 } 24 }
25 set ::testprefix select6
25 26
26 do_test select6-1.0 { 27 do_test select6-1.0 {
27 execsql { 28 execsql {
28 BEGIN; 29 BEGIN;
29 CREATE TABLE t1(x, y); 30 CREATE TABLE t1(x, y);
30 INSERT INTO t1 VALUES(1,1); 31 INSERT INTO t1 VALUES(1,1);
31 INSERT INTO t1 VALUES(2,2); 32 INSERT INTO t1 VALUES(2,2);
32 INSERT INTO t1 VALUES(3,2); 33 INSERT INTO t1 VALUES(3,2);
33 INSERT INTO t1 VALUES(4,3); 34 INSERT INTO t1 VALUES(4,3);
34 INSERT INTO t1 VALUES(5,3); 35 INSERT INTO t1 VALUES(5,3);
(...skipping 471 matching lines...)
506 SELECT x, y FROM (SELECT x, (SELECT 10+x) y FROM t1 LIMIT -1 OFFSET 1); 507 SELECT x, y FROM (SELECT x, (SELECT 10+x) y FROM t1 LIMIT -1 OFFSET 1);
507 } 508 }
508 } {2 12 3 13 4 14} 509 } {2 12 3 13 4 14}
509 do_test select6-9.11 { 510 do_test select6-9.11 {
510 execsql { 511 execsql {
511 SELECT x, y FROM (SELECT x, (SELECT 10)+x y FROM t1 LIMIT -1 OFFSET 1); 512 SELECT x, y FROM (SELECT x, (SELECT 10)+x y FROM t1 LIMIT -1 OFFSET 1);
512 } 513 }
513 } {2 12 3 13 4 14} 514 } {2 12 3 13 4 14}
514 515
515 516
517 #-------------------------------------------------------------------------
518 # Test that if a UNION ALL sub-query that would otherwise be eligible for
519 # flattening consists of two or more SELECT statements that do not all
520 # return the same number of result columns, the error is detected.
521 #
522 do_execsql_test 10.1 {
523 CREATE TABLE t(i,j,k);
524 CREATE TABLE j(l,m);
525 CREATE TABLE k(o);
526 }
527
528 set err [list 1 {SELECTs to the left and right of UNION ALL do not have the same number of result columns}]
529
530 do_execsql_test 10.2 {
531 SELECT * FROM (SELECT * FROM t), j;
532 }
533 do_catchsql_test 10.3 {
534 SELECT * FROM t UNION ALL SELECT * FROM j
535 } $err
536 do_catchsql_test 10.4 {
537 SELECT * FROM (SELECT i FROM t UNION ALL SELECT l, m FROM j)
538 } $err
539 do_catchsql_test 10.5 {
540 SELECT * FROM (SELECT j FROM t UNION ALL SELECT * FROM j)
541 } $err
542 do_catchsql_test 10.6 {
543 SELECT * FROM (SELECT * FROM t UNION ALL SELECT * FROM j)
544 } $err
545 do_catchsql_test 10.7 {
546 SELECT * FROM (
547 SELECT * FROM t UNION ALL
548 SELECT l,m,l FROM j UNION ALL
549 SELECT * FROM k
550 )
551 } $err
552 do_catchsql_test 10.8 {
553 SELECT * FROM (
554 SELECT * FROM k UNION ALL
555 SELECT * FROM t UNION ALL
556 SELECT l,m,l FROM j
557 )
558 } $err
559
516 560
517 finish_test 561 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/src/test/select4.test ('k') | third_party/sqlite/src/test/select7.test » ('j') | no next file with comments »

Powered by Google App Engine