3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this file is testing the CREATE INDEX statement.
14 # $Id: index2.test,v 1.2 2005/01/20 02:17:02 danielk1977 Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
19 # Create a table with a large number of columns
22 set sql {CREATE TABLE t1(}
23 for {set i 1} {$i<1000} {incr i} {
30 set sql {INSERT INTO t1 VALUES(}
31 for {set i 1} {$i<1000} {incr i} {
38 execsql {SELECT c123 FROM t1}
42 for {set j 1} {$j<=100} {incr j} {
43 set sql {INSERT INTO t1 VALUES(}
44 for {set i 1} {$i<1000} {incr i} {
45 append sql [expr {$j*10000+$i}],
47 append sql "[expr {$j*10000+1000}]);"
51 execsql {SELECT count(*) FROM t1}
54 execsql {SELECT round(sum(c1000)) FROM t1}
57 # Create indices with many columns
60 set sql "CREATE INDEX t1i1 ON t1("
61 for {set i 1} {$i<1000} {incr i} {
69 execsql {EXPLAIN SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5}
71 execsql {SELECT c9 FROM t1 ORDER BY c1, c2, c3, c4, c5, c6 LIMIT 5}
72 } {9 10009 20009 30009 40009}