30
create temporary table t2 engine=MEMORY select * from t1;
30
create table t2 engine=heap select * from t1;
32
32
create table t2 select auto+1 from t1;
33
33
drop table if exists t1,t2;
35
35
create table t1 (b char(0) not null, index(b));
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;
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;
44
44
create table not_existing_database.test (a int);
181
181
# Test default table type
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;
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;
242
242
--error ER_DUP_ENTRY
243
243
create table if not exists t1 select 3 as 'a',3 as 'b';
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;
328
326
create temporary table t3 like t1;
329
327
drop table t1, t2, t3;
330
329
drop database mysqltest;
333
332
# Test default table type
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;
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;
647
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
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;
648
660
# Tests for errors happening at various stages of CREATE TABLES ... SELECT
650
662
# (Also checks that it behaves atomically in the sense that in case
724
# CREATE TABLE ... SELECT and LOCK TABLES
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);
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;
739
create table t2 (j int);
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;
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;
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;
763
# OTOH CREATE TEMPORARY TABLE ... SELECT should work
764
# well under LOCK TABLES.
766
create temporary table t2 select * from t1;
767
create temporary table if not exists t2 select * from t1;
712
774
# Bug#21772: can not name a column 'upgrade' when create a table
714
776
create table t1 (upgrade int);
1096
1158
# Show that in case of multiple index type definitions, the last one takes
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;
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;
1168
1230
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1171
## Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
1233
# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
1174
1236
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1175
1237
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1176
1238
select database();
1179
select SCHEMA_NAME from data_dictionary.schemas
1241
select SCHEMA_NAME from information_schema.schemata
1180
1242
where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45';
1182
1244
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1190
1252
# database, table, field, key
1191
1253
select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1193
select TABLE_NAME from data_dictionary.tables where
1194
table_schema='test';
1196
select COLUMN_NAME from data_dictionary.columns where
1197
table_schema='test';
1199
select INDEX_NAME from data_dictionary.indexes where
1255
select TABLE_NAME from information_schema.tables where
1256
table_schema='test';
1258
select COLUMN_NAME from information_schema.columns where
1259
table_schema='test';
1261
select INDEX_NAME from information_schema.statistics where
1200
1262
table_schema='test';
1202
1264
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1205
1267
drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1209
1271
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
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;
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;