~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/create.test

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
select * from t1;
20
20
drop table t1;
21
21
 
22
 
create temporary table t1 (a int not null auto_increment,primary key (a)) engine=MEMORY;
 
22
create table t1 (a int not null auto_increment,primary key (a)) engine=heap;
23
23
drop table t1;
24
24
 
25
25
#
27
27
#
28
28
 
29
29
--error 1146
30
 
create temporary table t2 engine=MEMORY select * from t1;
 
30
create table t2 engine=heap select * from t1;
31
31
--error 1146
32
32
create table t2 select auto+1 from t1;
33
33
drop table if exists t1,t2;
34
34
--error 1167
35
35
create table t1 (b char(0) not null, index(b));
36
36
--error 1163
37
 
create temporary table t1 (a int not null,b text) engine=MEMORY;
 
37
create table t1 (a int not null,b text) engine=heap;
38
38
drop table if exists t1;
39
39
 
40
40
--error 1075
41
 
create temporary table t1 (ordid int not null auto_increment, ord  varchar(50) not null, primary key (ord,ordid)) engine=MEMORY;
 
41
create table t1 (ordid int not null auto_increment, ord  varchar(50) not null, primary key (ord,ordid)) engine=heap;
42
42
 
43
43
-- error 1049
44
44
create table not_existing_database.test (a int);
180
180
#
181
181
# Test default table type
182
182
#
183
 
SET SESSION storage_engine="MEMORY";
 
183
SET SESSION storage_engine="heap";
184
184
SELECT @@storage_engine;
185
 
CREATE TEMPORARY TABLE t1 (a int not null);
 
185
CREATE TABLE t1 (a int not null);
186
186
show create table t1;
187
187
drop table t1;
188
188
--error 1286
189
189
SET SESSION storage_engine="gemini";
190
190
SELECT @@storage_engine;
191
 
CREATE TEMPORARY TABLE t1 (a int not null);
 
191
CREATE TABLE t1 (a int not null);
192
192
show create table t1;
193
193
SET SESSION storage_engine=default;
194
194
drop table t1;
242
242
--error ER_DUP_ENTRY
243
243
create table if not exists t1 select 3 as 'a',3 as 'b';
244
244
show warnings;
245
 
--replace_column 3 # 4 # 5 #
246
 
select * from DATA_DICTIONARY.TABLE_DEFINITION_CACHE WHERE TABLE_COUNT > 1 ORDER BY TABLE_SCHEMA, TABLE_NAME;
 
245
show status like "Opened_tables";
247
246
select * from t1;
248
247
drop table t1;
249
248
 
316
315
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
317
316
show create table t2;
318
317
select * from t2;
319
 
--error 1050
320
318
create table t3 like t1;
321
319
--error 1050
322
320
create table t3 like mysqltest.t3;
327
325
--error 1050
328
326
create temporary table t3 like t1;
329
327
drop table t1, t2, t3;
 
328
drop table t3;
330
329
drop database mysqltest;
331
330
 
332
331
#
333
332
# Test default table type
334
333
#
335
 
SET SESSION storage_engine="MEMORY";
 
334
SET SESSION storage_engine="heap";
336
335
SELECT @@storage_engine;
337
 
CREATE TEMPORARY TABLE t1 (a int not null);
 
336
CREATE TABLE t1 (a int not null);
338
337
show create table t1;
339
338
drop table t1;
340
339
--error 1286
341
340
SET SESSION storage_engine="gemini";
342
341
SELECT @@storage_engine;
343
 
CREATE TEMPORARY TABLE t1 (a int not null);
 
342
CREATE TABLE t1 (a int not null);
344
343
show create table t1;
345
344
SET SESSION storage_engine=default;
346
345
drop table t1;
645
644
 
646
645
 
647
646
#
 
647
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
 
648
# platforms
 
649
#
 
650
create table t1 (i int) engine=myisam max_rows=100000000000;
 
651
show create table t1;
 
652
alter table t1 max_rows=100;
 
653
show create table t1;
 
654
alter table t1 max_rows=100000000000;
 
655
show create table t1;
 
656
drop table t1;
 
657
 
 
658
 
 
659
#
648
660
# Tests for errors happening at various stages of CREATE TABLES ... SELECT
649
661
#
650
662
# (Also checks that it behaves atomically in the sense that in case
709
721
 
710
722
 
711
723
#
 
724
# CREATE TABLE ... SELECT and LOCK TABLES
 
725
#
 
726
# There is little sense in using CREATE TABLE ... SELECT under
 
727
# LOCK TABLES as it mostly does not work. At least we check that
 
728
# the server doesn't crash, hang and produces sensible errors.
 
729
# Includes test for bug #20662 "Infinite loop in CREATE TABLE
 
730
# IF NOT EXISTS ... SELECT with locked tables".
 
731
create table t1 (i int);
 
732
insert into t1 values (1), (2);
 
733
lock tables t1 read;
 
734
--error ER_TABLE_NOT_LOCKED
 
735
create table t2 select * from t1;
 
736
--error ER_TABLE_NOT_LOCKED
 
737
create table if not exists t2 select * from t1;
 
738
unlock tables;
 
739
create table t2 (j int);
 
740
lock tables t1 read;
 
741
--error ER_TABLE_NOT_LOCKED
 
742
create table t2 select * from t1;
 
743
# This should not be ever allowed as it will undermine
 
744
# lock-all-at-once approach
 
745
--error ER_TABLE_NOT_LOCKED
 
746
create table if not exists t2 select * from t1;
 
747
unlock tables;
 
748
lock table t1 read, t2 read;
 
749
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
 
750
create table t2 select * from t1;
 
751
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
 
752
create table if not exists t2 select * from t1;
 
753
unlock tables;
 
754
lock table t1 read, t2 write;
 
755
--error ER_TABLE_EXISTS_ERROR
 
756
create table t2 select * from t1;
 
757
# This is the only case which really works.
 
758
create table if not exists t2 select * from t1;
 
759
select * from t1;
 
760
unlock tables;
 
761
drop table t2;
 
762
 
 
763
# OTOH CREATE TEMPORARY TABLE ... SELECT should work
 
764
# well under LOCK TABLES.
 
765
lock tables t1 read;
 
766
create temporary table t2 select * from t1;
 
767
create temporary table if not exists t2 select * from t1;
 
768
select * from t2;
 
769
unlock tables;
 
770
drop table t1, t2;
 
771
 
 
772
 
 
773
#
712
774
# Bug#21772: can not name a column 'upgrade' when create a table
713
775
#
714
776
create table t1 (upgrade int);
1096
1158
# Show that in case of multiple index type definitions, the last one takes 
1097
1159
# precedence
1098
1160
 
1099
 
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
1100
 
#SHOW INDEX FROM t1;
 
1161
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
 
1162
SHOW INDEX FROM t1;
1101
1163
DROP TABLE t1;
1102
1164
 
1103
 
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
1104
 
#SHOW INDEX FROM t1;
 
1165
CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
 
1166
SHOW INDEX FROM t1;
1105
1167
DROP TABLE t1;
1106
1168
 
1107
1169
 
1167
1229
--error 1102
1168
1230
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1169
1231
 
1170
 
##
1171
 
## Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
1172
 
##
 
1232
#
 
1233
# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
 
1234
#
1173
1235
 
1174
1236
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1175
1237
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1176
1238
select database();
1177
1239
use test;
1178
1240
 
1179
 
select SCHEMA_NAME from data_dictionary.schemas
 
1241
select SCHEMA_NAME from information_schema.schemata
1180
1242
where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45';
1181
1243
 
1182
1244
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1190
1252
# database, table, field, key
1191
1253
select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1192
1254
 
1193
 
select TABLE_NAME from data_dictionary.tables where
1194
 
table_schema='test';
1195
 
 
1196
 
select COLUMN_NAME from data_dictionary.columns where
1197
 
table_schema='test';
1198
 
 
1199
 
select INDEX_NAME from data_dictionary.indexes where
 
1255
select TABLE_NAME from information_schema.tables where
 
1256
table_schema='test';
 
1257
 
 
1258
select COLUMN_NAME from information_schema.columns where
 
1259
table_schema='test';
 
1260
 
 
1261
select INDEX_NAME from information_schema.statistics where
1200
1262
table_schema='test';
1201
1263
 
1202
1264
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1204
1266
 
1205
1267
drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1206
1268
 
1207
 
#
 
1269
 
1208
1270
#
1209
1271
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
1210
1272
#
1211
 
--error 1005
1212
 
create table t1 like data_dictionary.processlist;
1213
 
create table t1 like data_dictionary.processlist engine=innodb;
 
1273
create table t1 like information_schema.processlist;
1214
1274
show create table t1;
1215
1275
drop table t1;
1216
 
--error 1005
1217
 
create temporary table t1 like data_dictionary.processlist;
1218
 
create temporary table t1 like data_dictionary.processlist engine=myisam;
 
1276
create temporary table t1 like information_schema.processlist;
1219
1277
show create table t1;
1220
1278
drop table t1;
1221
1279