OLD | NEW |
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 #*********************************************************************** |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 # Try adding an index to a table that does not exist | 49 # Try adding an index to a table that does not exist |
50 # | 50 # |
51 do_test index-2.1 { | 51 do_test index-2.1 { |
52 set v [catch {execsql {CREATE INDEX index1 ON test1(f1)}} msg] | 52 set v [catch {execsql {CREATE INDEX index1 ON test1(f1)}} msg] |
53 lappend v $msg | 53 lappend v $msg |
54 } {1 {no such table: main.test1}} | 54 } {1 {no such table: main.test1}} |
55 | 55 |
56 # Try adding an index on a column of a table where the table | 56 # Try adding an index on a column of a table where the table |
57 # exists but the column does not. | 57 # exists but the column does not. |
58 # | 58 # |
59 do_test index-2.1 { | 59 do_test index-2.1b { |
60 execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)} | 60 execsql {CREATE TABLE test1(f1 int, f2 int, f3 int)} |
61 set v [catch {execsql {CREATE INDEX index1 ON test1(f4)}} msg] | 61 set v [catch {execsql {CREATE INDEX index1 ON test1(f4)}} msg] |
62 lappend v $msg | 62 lappend v $msg |
63 } {1 {table test1 has no column named f4}} | 63 } {1 {no such column: f4}} |
64 | 64 |
65 # Try an index with some columns that match and others that do now. | 65 # Try an index with some columns that match and others that do now. |
66 # | 66 # |
67 do_test index-2.2 { | 67 do_test index-2.2 { |
68 set v [catch {execsql {CREATE INDEX index1 ON test1(f1, f2, f4, f3)}} msg] | 68 set v [catch {execsql {CREATE INDEX index1 ON test1(f1, f2, f4, f3)}} msg] |
69 execsql {DROP TABLE test1} | 69 execsql {DROP TABLE test1} |
70 lappend v $msg | 70 lappend v $msg |
71 } {1 {table test1 has no column named f4}} | 71 } {1 {no such column: f4}} |
72 | 72 |
73 # Try creating a bunch of indices on the same table | 73 # Try creating a bunch of indices on the same table |
74 # | 74 # |
75 set r {} | 75 set r {} |
76 for {set i 1} {$i<100} {incr i} { | 76 for {set i 1} {$i<100} {incr i} { |
77 lappend r [format index%02d $i] | 77 lappend r [format index%02d $i] |
78 } | 78 } |
79 do_test index-3.1 { | 79 do_test index-3.1 { |
80 execsql {CREATE TABLE test1(f1 int, f2 int, f3 int, f4 int, f5 int)} | 80 execsql {CREATE TABLE test1(f1 int, f2 int, f3 int, f4 int, f5 int)} |
81 for {set i 1} {$i<100} {incr i} { | 81 for {set i 1} {$i<100} {incr i} { |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 CREATE TEMP TABLE t6(x); | 728 CREATE TEMP TABLE t6(x); |
729 INSERT INTO temp.t6 values(1),(5),(9); | 729 INSERT INTO temp.t6 values(1),(5),(9); |
730 CREATE INDEX temp.i21 ON t6(x); | 730 CREATE INDEX temp.i21 ON t6(x); |
731 SELECT x FROM t6 ORDER BY x DESC; | 731 SELECT x FROM t6 ORDER BY x DESC; |
732 } | 732 } |
733 } {0 {9 5 1}} | 733 } {0 {9 5 1}} |
734 | 734 |
735 | 735 |
736 | 736 |
737 finish_test | 737 finish_test |
OLD | NEW |