drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 1 | # Copyright (c) 1999, 2000 D. Richard Hipp |
| 2 | # |
| 3 | # This program is free software; you can redistribute it and/or |
| 4 | # modify it under the terms of the GNU General Public |
| 5 | # License as published by the Free Software Foundation; either |
| 6 | # version 2 of the License, or (at your option) any later version. |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | # General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU General Public |
| 14 | # License along with this library; if not, write to the |
| 15 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 16 | # Boston, MA 02111-1307, USA. |
| 17 | # |
| 18 | # Author contact information: |
| 19 | # drh@hwaci.com |
| 20 | # http://www.hwaci.com/drh/ |
| 21 | # |
| 22 | #*********************************************************************** |
| 23 | # This file implements regression tests for SQLite library. The |
| 24 | # focus of this file is testing the CREATE TABLE statement. |
| 25 | # |
drh | d400728 | 2001-04-12 23:21:58 +0000 | [diff] [blame^] | 26 | # $Id: table.test,v 1.9 2001/04/12 23:21:59 drh Exp $ |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 27 | |
| 28 | set testdir [file dirname $argv0] |
| 29 | source $testdir/tester.tcl |
| 30 | |
| 31 | # Create a basic table and verify it is added to sqlite_master |
| 32 | # |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 33 | do_test table-1.1 { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 34 | execsql { |
| 35 | CREATE TABLE test1 ( |
| 36 | one varchar(10), |
| 37 | two text |
| 38 | ) |
| 39 | } |
| 40 | execsql { |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 41 | SELECT sql FROM sqlite_master WHERE type!='meta' |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 42 | } |
| 43 | } {{CREATE TABLE test1 ( |
| 44 | one varchar(10), |
| 45 | two text |
| 46 | )}} |
| 47 | |
| 48 | # Verify that both table files exists in the database directory |
| 49 | # |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 50 | do_test table-1.2 { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 51 | execsql {INSERT INTO test1 VALUES('hi', 'y''all')} |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 52 | } {} |
| 53 | testif gdbm: |
| 54 | do_test table-1.2b { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 55 | lsort [glob -nocomplain testdb/*.tbl] |
| 56 | } {testdb/sqlite_master.tbl testdb/test1.tbl} |
| 57 | |
| 58 | # Verify the other fields of the sqlite_master file. |
| 59 | # |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 60 | do_test table-1.3 { |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 61 | execsql {SELECT name, tbl_name, type FROM sqlite_master WHERE type!='meta'} |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 62 | } {test1 test1 table} |
| 63 | |
| 64 | # Close and reopen the database. Verify that everything is |
| 65 | # still the same. |
| 66 | # |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 67 | skipif memory: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 68 | do_test table-1.4 { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 69 | db close |
| 70 | sqlite db testdb |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 71 | execsql {SELECT name, tbl_name, type from sqlite_master WHERE type!='meta'} |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 72 | } {test1 test1 table} |
| 73 | |
| 74 | # Drop the database and make sure it disappears. |
| 75 | # |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 76 | do_test table-1.5 { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 77 | execsql {DROP TABLE test1} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 78 | execsql {SELECT * FROM sqlite_master WHERE type!='meta'} |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 79 | } {} |
| 80 | |
| 81 | # Verify that the file associated with the database is gone. |
| 82 | # |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 83 | testif gdbm: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 84 | do_test table-1.5 { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 85 | lsort [glob -nocomplain testdb/*.tbl] |
| 86 | } {testdb/sqlite_master.tbl} |
| 87 | |
| 88 | # Close and reopen the database. Verify that the table is |
| 89 | # still gone. |
| 90 | # |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 91 | skipif memory: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 92 | do_test table-1.6 { |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 93 | db close |
| 94 | sqlite db testdb |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 95 | execsql {SELECT name FROM sqlite_master WHERE type!='meta'} |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 96 | } {} |
| 97 | |
drh | 982cef7 | 2000-05-30 16:27:03 +0000 | [diff] [blame] | 98 | # Repeat the above steps, but this time quote the table name. |
| 99 | # |
| 100 | do_test table-1.10 { |
| 101 | execsql {CREATE TABLE "create" (f1 int)} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 102 | execsql {SELECT name FROM sqlite_master WHERE type!='meta'} |
drh | 982cef7 | 2000-05-30 16:27:03 +0000 | [diff] [blame] | 103 | } {create} |
| 104 | do_test table-1.11 { |
| 105 | execsql {DROP TABLE "create"} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 106 | execsql {SELECT name FROM "sqlite_master" WHERE type!='meta'} |
drh | 982cef7 | 2000-05-30 16:27:03 +0000 | [diff] [blame] | 107 | } {} |
| 108 | do_test table-1.12 { |
| 109 | execsql {CREATE TABLE test1("f1 ho" int)} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 110 | execsql {SELECT name as "X" FROM sqlite_master WHERE type!='meta'} |
drh | 982cef7 | 2000-05-30 16:27:03 +0000 | [diff] [blame] | 111 | } {test1} |
| 112 | do_test table-1.13 { |
| 113 | execsql {DROP TABLE "TEST1"} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 114 | execsql {SELECT name FROM "sqlite_master" WHERE type!='meta'} |
drh | 982cef7 | 2000-05-30 16:27:03 +0000 | [diff] [blame] | 115 | } {} |
| 116 | |
| 117 | |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 118 | |
| 119 | # Verify that we cannot make two tables with the same name |
| 120 | # |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 121 | do_test table-2.1 { |
drh | 4cfa793 | 2000-06-08 15:10:46 +0000 | [diff] [blame] | 122 | execsql {CREATE TABLE TEST2(one text)} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 123 | set v [catch {execsql {CREATE TABLE test2(two text)}} msg] |
| 124 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 125 | } {1 {table test2 already exists}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 126 | do_test table-2.1b { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 127 | set v [catch {execsql {CREATE TABLE sqlite_master(two text)}} msg] |
| 128 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 129 | } {1 {table sqlite_master already exists}} |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 130 | skipif memory: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 131 | do_test table-2.1c { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 132 | db close |
| 133 | sqlite db testdb |
| 134 | set v [catch {execsql {CREATE TABLE sqlite_master(two text)}} msg] |
| 135 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 136 | } {1 {table sqlite_master already exists}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 137 | do_test table-2.1d { |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 138 | execsql {DROP TABLE test2; SELECT name FROM sqlite_master WHERE type!='meta'} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 139 | } {} |
| 140 | |
| 141 | # Verify that we cannot make a table with the same name as an index |
| 142 | # |
drh | dcc581c | 2000-05-30 13:44:19 +0000 | [diff] [blame] | 143 | do_test table-2.2a { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 144 | execsql {CREATE TABLE test2(one text); CREATE INDEX test3 ON test2(one)} |
| 145 | set v [catch {execsql {CREATE TABLE test3(two text)}} msg] |
| 146 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 147 | } {1 {there is already an index named test3}} |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 148 | skipif memory: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 149 | do_test table-2.2b { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 150 | db close |
| 151 | sqlite db testdb |
| 152 | set v [catch {execsql {CREATE TABLE test3(two text)}} msg] |
| 153 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 154 | } {1 {there is already an index named test3}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 155 | do_test table-2.2c { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 156 | execsql {DROP INDEX test3} |
| 157 | set v [catch {execsql {CREATE TABLE test3(two text)}} msg] |
| 158 | lappend v $msg |
| 159 | } {0 {}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 160 | do_test table-2.2d { |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 161 | execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 162 | } {test2 test3} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 163 | do_test table-2.2e { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 164 | execsql {DROP TABLE test2; DROP TABLE test3} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 165 | execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 166 | } {} |
| 167 | |
| 168 | # Create a table with many field names |
| 169 | # |
| 170 | set big_table \ |
| 171 | {CREATE TABLE big( |
| 172 | f1 varchar(20), |
| 173 | f2 char(10), |
drh | dcc581c | 2000-05-30 13:44:19 +0000 | [diff] [blame] | 174 | f3 varchar(30) primary key, |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 175 | f4 text, |
| 176 | f5 text, |
| 177 | f6 text, |
| 178 | f7 text, |
| 179 | f8 text, |
| 180 | f9 text, |
| 181 | f10 text, |
| 182 | f11 text, |
| 183 | f12 text, |
| 184 | f13 text, |
| 185 | f14 text, |
| 186 | f15 text, |
| 187 | f16 text, |
| 188 | f17 text, |
| 189 | f18 text, |
| 190 | f19 text, |
| 191 | f20 text |
| 192 | )} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 193 | do_test table-3.1 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 194 | execsql $big_table |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 195 | execsql {SELECT sql FROM sqlite_master WHERE type!='meta'} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 196 | } \{$big_table\} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 197 | do_test table-3.2 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 198 | set v [catch {execsql {CREATE TABLE BIG(xyz foo)}} msg] |
| 199 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 200 | } {1 {table BIG already exists}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 201 | do_test table-3.3 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 202 | set v [catch {execsql {CREATE TABLE biG(xyz foo)}} msg] |
| 203 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 204 | } {1 {table biG already exists}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 205 | do_test table-3.4 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 206 | set v [catch {execsql {CREATE TABLE bIg(xyz foo)}} msg] |
| 207 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 208 | } {1 {table bIg already exists}} |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 209 | skipif memory: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 210 | do_test table-3.5 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 211 | db close |
| 212 | sqlite db testdb |
| 213 | set v [catch {execsql {CREATE TABLE Big(xyz foo)}} msg] |
| 214 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 215 | } {1 {table Big already exists}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 216 | do_test table-3.6 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 217 | execsql {DROP TABLE big} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 218 | execsql {SELECT name FROM sqlite_master WHERE type!='meta'} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 219 | } {} |
| 220 | |
| 221 | # Try creating large numbers of tables |
| 222 | # |
| 223 | set r {} |
| 224 | for {set i 1} {$i<=100} {incr i} { |
| 225 | lappend r test$i |
| 226 | } |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 227 | do_test table-4.1 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 228 | for {set i 1} {$i<=100} {incr i} { |
| 229 | set sql "CREATE TABLE test$i (" |
| 230 | for {set k 1} {$k<$i} {incr k} { |
| 231 | append sql "field$k text," |
| 232 | } |
| 233 | append sql "last_field text)" |
| 234 | execsql $sql |
| 235 | } |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 236 | execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 237 | } $r |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 238 | skipif memory: |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 239 | do_test table-4.1b { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 240 | db close |
| 241 | sqlite db testdb |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 242 | execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 243 | } $r |
| 244 | |
drh | c4a3c77 | 2001-04-04 11:48:57 +0000 | [diff] [blame] | 245 | # Drop the even numbered tables |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 246 | # |
| 247 | set r {} |
| 248 | for {set i 1} {$i<=100} {incr i 2} { |
| 249 | lappend r test$i |
| 250 | } |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 251 | do_test table-4.2 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 252 | for {set i 2} {$i<=100} {incr i 2} { |
| 253 | set sql "DROP TABLE TEST$i" |
| 254 | execsql $sql |
| 255 | } |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 256 | execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 257 | } $r |
| 258 | |
| 259 | # Drop the odd number tables |
| 260 | # |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 261 | do_test table-4.3 { |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 262 | for {set i 1} {$i<=100} {incr i 2} { |
| 263 | set sql "DROP TABLE test$i" |
| 264 | execsql $sql |
| 265 | } |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 266 | execsql {SELECT name FROM sqlite_master WHERE type!='meta' ORDER BY name} |
drh | b24fcbe | 2000-05-29 23:30:50 +0000 | [diff] [blame] | 267 | } {} |
| 268 | |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 269 | # Try to drop a table that does not exist |
| 270 | # |
| 271 | do_test table-5.1 { |
| 272 | set v [catch {execsql {DROP TABLE test9}} msg] |
| 273 | lappend v $msg |
| 274 | } {1 {no such table: test9}} |
| 275 | |
| 276 | # Try to drop sqlite_master |
| 277 | # |
| 278 | do_test table-5.2 { |
| 279 | set v [catch {execsql {DROP TABLE sqlite_master}} msg] |
| 280 | lappend v $msg |
drh | 1d37e28 | 2000-05-30 03:12:21 +0000 | [diff] [blame] | 281 | } {1 {table sqlite_master may not be dropped}} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 282 | |
| 283 | # Make sure an EXPLAIN does not really create a new table |
| 284 | # |
| 285 | do_test table-5.3 { |
| 286 | execsql {EXPLAIN CREATE TABLE test1(f1 int)} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 287 | execsql {SELECT name FROM sqlite_master WHERE type!='meta'} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 288 | } {} |
| 289 | |
| 290 | # Make sure an EXPLAIN does not really drop an existing table |
| 291 | # |
| 292 | do_test table-5.4 { |
| 293 | execsql {CREATE TABLE test1(f1 int)} |
| 294 | execsql {EXPLAIN DROP TABLE test1} |
drh | 2803757 | 2000-08-02 13:47:41 +0000 | [diff] [blame] | 295 | execsql {SELECT name FROM sqlite_master WHERE type!='meta'} |
drh | 1b6a71f | 2000-05-29 23:58:11 +0000 | [diff] [blame] | 296 | } {test1} |
| 297 | |
drh | 4cfa793 | 2000-06-08 15:10:46 +0000 | [diff] [blame] | 298 | # Create a table with a goofy name |
| 299 | # |
drh | 767c200 | 2000-10-19 14:10:08 +0000 | [diff] [blame] | 300 | testif gdbm: |
drh | 4cfa793 | 2000-06-08 15:10:46 +0000 | [diff] [blame] | 301 | do_test table-6.1 { |
| 302 | execsql {CREATE TABLE 'Spaces In This Name!'(x int)} |
| 303 | execsql {INSERT INTO 'spaces in this name!' VALUES(1)} |
| 304 | set list [glob -nocomplain testdb/spaces*.tbl] |
| 305 | } {testdb/spaces+in+this+name+.tbl} |
| 306 | |
drh | c4a3c77 | 2001-04-04 11:48:57 +0000 | [diff] [blame] | 307 | # Try using keywords as table names or column names. |
| 308 | # |
| 309 | do_test table-7.1 { |
| 310 | set v [catch {execsql { |
| 311 | CREATE TABLE weird( |
| 312 | desc text, |
| 313 | asc text, |
| 314 | explain int, |
| 315 | vacuum boolean, |
drh | d400728 | 2001-04-12 23:21:58 +0000 | [diff] [blame^] | 316 | delimiters varchar(10), |
| 317 | begin blob, |
| 318 | end clob |
drh | c4a3c77 | 2001-04-04 11:48:57 +0000 | [diff] [blame] | 319 | ) |
| 320 | }} msg] |
| 321 | lappend v $msg |
| 322 | } {0 {}} |
| 323 | do_test table-7.2 { |
| 324 | execsql { |
drh | d400728 | 2001-04-12 23:21:58 +0000 | [diff] [blame^] | 325 | INSERT INTO weird VALUES('a','b',9,0,'xyz','hi','y''all'); |
drh | c4a3c77 | 2001-04-04 11:48:57 +0000 | [diff] [blame] | 326 | SELECT * FROM weird; |
| 327 | } |
drh | d400728 | 2001-04-12 23:21:58 +0000 | [diff] [blame^] | 328 | } {a b 9 0 xyz hi y'all} |
drh | c4a3c77 | 2001-04-04 11:48:57 +0000 | [diff] [blame] | 329 | do_test table-7.3 { |
| 330 | execsql2 { |
| 331 | SELECT * FROM weird; |
| 332 | } |
drh | d400728 | 2001-04-12 23:21:58 +0000 | [diff] [blame^] | 333 | } {desc a asc b explain 9 vacuum 0 delimiters xyz begin hi end y'all} |
drh | c4a3c77 | 2001-04-04 11:48:57 +0000 | [diff] [blame] | 334 | |
drh | 348784e | 2000-05-29 20:41:49 +0000 | [diff] [blame] | 335 | finish_test |