19
create temporary table t1 (a int not null auto_increment,primary key (a)) engine=MEMORY;
19
create table t1 (a int not null auto_increment,primary key (a)) engine=heap;
21
create temporary table t2 engine=MEMORY select * from t1;
21
create table t2 engine=heap select * from t1;
22
22
ERROR 42S02: Table 'test.t1' doesn't exist
23
23
create table t2 select auto+1 from t1;
24
24
ERROR 42S02: Table 'test.t1' doesn't exist
28
28
Note 1051 Unknown table 't2'
29
29
create table t1 (b char(0) not null, index(b));
30
30
ERROR 42000: The used storage engine can't index column 'b'
31
create temporary table t1 (a int not null,b text) engine=MEMORY;
31
create table t1 (a int not null,b text) engine=heap;
32
32
ERROR 42000: The used table type doesn't support BLOB/TEXT columns
33
33
drop table if exists t1;
35
35
Note 1051 Unknown table 't1'
36
create temporary table t1 (ordid int not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=MEMORY;
36
create table t1 (ordid int not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=heap;
37
37
ERROR 42000: Incorrect table definition; there can be only one auto column and it must be defined as a key
38
38
create table not_existing_database.test (a int);
39
39
ERROR 42000: Unknown database 'not_existing_database'
107
107
create table t1(x varchar(50) );
108
108
create table t2 select x from t1 where 1=2;
110
Field Type Null Default Default_is_NULL On_Update
110
Field Type Null Key Default Extra
111
x varchar(50) YES NULL
113
Field Type Null Default Default_is_NULL On_Update
113
Field Type Null Key Default Extra
114
x varchar(50) YES NULL
116
116
create table t2 select now() as a , curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
118
Field Type Null Default Default_is_NULL On_Update
121
d INTEGER FALSE FALSE
122
e DECIMAL FALSE FALSE
118
Field Type Null Key Default Extra
122
e decimal(3,1) NO NULL
125
125
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
127
Field Type Null Default Default_is_NULL On_Update
129
dt DATETIME TRUE TRUE
127
Field Type Null Key Default Extra
130
130
drop table t1,t2;
131
131
create table t1 (a int);
132
132
create table t2 (a int) select * from t1;
134
Field Type Null Default Default_is_NULL On_Update
134
Field Type Null Key Default Extra
137
Field Type Null Default Default_is_NULL On_Update
137
Field Type Null Key Default Extra
139
139
drop table if exists t2;
140
140
create table t2 (a int, a float) select * from t1;
141
141
ERROR 42S21: Duplicate column name 'a'
209
209
if('2002'='2002','Y','N')
211
211
drop table if exists t1;
212
SET SESSION storage_engine="MEMORY";
212
SET SESSION storage_engine="heap";
213
213
SELECT @@storage_engine;
216
CREATE TEMPORARY TABLE t1 (a int not null);
216
CREATE TABLE t1 (a int not null);
217
217
show create table t1;
218
218
Table Create Table
219
t1 CREATE TEMPORARY TABLE `t1` (
219
t1 CREATE TABLE `t1` (
270
270
Level Code Message
271
271
Note 1050 Table 't1' already exists
272
272
Error 1062 Duplicate entry '3' for key 'PRIMARY'
273
select * from DATA_DICTIONARY.TABLE_DEFINITION_CACHE WHERE TABLE_COUNT > 1 ORDER BY TABLE_SCHEMA, TABLE_NAME;
274
TABLE_SCHEMA TABLE_NAME VERSION TABLE_COUNT IS_NAME_LOCKED
273
show status like "Opened_tables";
275
276
select * from t1;
362
362
create temporary table t3 like t1;
363
363
ERROR 42S01: Table 't3' already exists
364
364
drop table t1, t2, t3;
365
366
drop database mysqltest;
366
SET SESSION storage_engine="MEMORY";
367
SET SESSION storage_engine="heap";
367
368
SELECT @@storage_engine;
370
CREATE TEMPORARY TABLE t1 (a int not null);
371
CREATE TABLE t1 (a int not null);
371
372
show create table t1;
372
373
Table Create Table
373
t1 CREATE TEMPORARY TABLE `t1` (
374
t1 CREATE TABLE `t1` (
452
453
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
453
454
insert into t1 values ('','',0,0.0);
455
Field Type Null Default Default_is_NULL On_Update
456
str VARCHAR TRUE def FALSE
457
strnull VARCHAR TRUE TRUE
458
intg INTEGER TRUE 10 FALSE
459
rel DOUBLE TRUE 3.14 FALSE
456
Field Type Null Key Default Extra
457
str varchar(10) YES def
458
strnull varchar(10) YES NULL
460
461
create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
462
Field Type Null Default Default_is_NULL On_Update
463
str VARCHAR TRUE TRUE
464
strnull VARCHAR TRUE TRUE
465
intg INTEGER TRUE TRUE
463
Field Type Null Key Default Extra
464
str varchar(10) YES NULL
465
strnull varchar(10) YES NULL
467
468
drop table t1, t2;
468
469
create table t1(name varchar(10), age int default -1);
470
Field Type Null Default Default_is_NULL On_Update
471
name VARCHAR TRUE TRUE
472
age INTEGER TRUE -1 FALSE
471
Field Type Null Key Default Extra
472
name varchar(10) YES NULL
473
474
create table t2(name varchar(10), age int default - 1);
475
Field Type Null Default Default_is_NULL On_Update
476
name VARCHAR TRUE TRUE
477
age INTEGER TRUE -1 FALSE
476
Field Type Null Key Default Extra
477
name varchar(10) YES NULL
478
479
drop table t1, t2;
479
480
create table t1(cenum enum('a'));
480
481
create table t2(cenum enum('a','a'));
521
522
CREATE TABLE t1 (f1 VARCHAR(255));
522
523
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
524
Field Type Null Default Default_is_NULL On_Update
525
Field Type Null Key Default Extra
526
f2 varchar(171) YES NULL
526
527
DROP TABLE t1,t2;
527
528
CREATE TABLE t12913 (f1 ENUM ('a','b')) AS SELECT 'a' AS f1;
528
529
SELECT * FROM t12913;
655
656
`a2` int DEFAULT NULL
657
658
drop table t1, t2;
659
create table t1 (i int) engine=myisam max_rows=100000000000;
660
show create table t1;
662
t1 CREATE TABLE `t1` (
664
) ENGINE=MyISAM MAX_ROWS=100000000000
665
alter table t1 max_rows=100;
666
show create table t1;
668
t1 CREATE TABLE `t1` (
670
) ENGINE=MyISAM MAX_ROWS=100
671
alter table t1 max_rows=100000000000;
672
show create table t1;
674
t1 CREATE TABLE `t1` (
676
) ENGINE=MyISAM MAX_ROWS=100000000000
658
678
create table t1 select * from t2;
659
679
ERROR 42S02: Table 'test.t2' doesn't exist
660
680
create table t1 select * from t1;
687
707
ERROR 42S02: Table 'test.t1' doesn't exist
689
709
ERROR 42S02: Unknown table 't1'
710
create table t1 (i int);
711
insert into t1 values (1), (2);
713
create table t2 select * from t1;
714
ERROR HY000: Table 't2' was not locked with LOCK TABLES
715
create table if not exists t2 select * from t1;
716
ERROR HY000: Table 't2' was not locked with LOCK TABLES
718
create table t2 (j int);
720
create table t2 select * from t1;
721
ERROR HY000: Table 't2' was not locked with LOCK TABLES
722
create table if not exists t2 select * from t1;
723
ERROR HY000: Table 't2' was not locked with LOCK TABLES
725
lock table t1 read, t2 read;
726
create table t2 select * from t1;
727
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
728
create table if not exists t2 select * from t1;
729
ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
731
lock table t1 read, t2 write;
732
create table t2 select * from t1;
733
ERROR 42S01: Table 't2' already exists
734
create table if not exists t2 select * from t1;
736
Note 1050 Table 't2' already exists
744
create temporary table t2 select * from t1;
745
create temporary table if not exists t2 select * from t1;
747
Note 1050 Table 't2' already exists
690
756
create table t1 (upgrade int);
692
758
create table t1 (
1354
1420
Handler_read_next 0
1355
1421
Handler_read_prev 0
1356
1422
Handler_read_rnd 0
1357
Handler_read_rnd_next 13
1423
Handler_read_rnd_next 7
1358
1424
drop table t1,t2;
1359
1425
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
1361
1427
CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
1363
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
1429
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
1431
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
1432
t1 1 c1 1 c1 NULL 0 NULL NULL YES HASH
1365
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
1434
CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
1436
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
1437
t1 1 c1 1 c1 A NULL NULL NULL YES BTREE
1367
1439
End of 5.0 tests
1368
1440
CREATE TABLE t1 (a int, b int);
1403
1475
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
1405
select SCHEMA_NAME from data_dictionary.schemas
1477
select SCHEMA_NAME from information_schema.schemata
1406
1478
where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45';
1408
1480
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
1415
1487
select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1416
1488
имя_поля_в_кодировке_утф8_длиной_больше_чем_45
1417
select TABLE_NAME from data_dictionary.tables where
1489
select TABLE_NAME from information_schema.tables where
1418
1490
table_schema='test';
1420
1492
имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
1421
select COLUMN_NAME from data_dictionary.columns where
1493
select COLUMN_NAME from information_schema.columns where
1422
1494
table_schema='test';
1424
1496
имя_поля_в_кодировке_утф8_длиной_больше_чем_45
1425
select INDEX_NAME from data_dictionary.indexes where
1497
select INDEX_NAME from information_schema.statistics where
1426
1498
table_schema='test';
1428
1500
имя_индекса_в_кодировке_утф8_длиной_больше_чем_48
1433
1505
KEY `имя_индекса_в_кодировке_утф8_длиной_больше_чем_48` (`имя_поля_в_кодировке_утф8_длиной_больше_чем_45`)
1434
1506
) ENGINE=DEFAULT
1435
1507
drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1436
create table t1 like data_dictionary.processlist;
1437
ERROR HY000: Can't create table 'test.t1' (errno: 1)
1438
create table t1 like data_dictionary.processlist engine=innodb;
1508
create table t1 like information_schema.processlist;
1439
1509
show create table t1;
1440
1510
Table Create Table
1441
1511
t1 CREATE TABLE `t1` (
1442
1512
`ID` bigint NOT NULL DEFAULT '0',
1443
1513
`USER` varchar(16) NOT NULL DEFAULT '',
1444
`HOST` varchar(1025) NOT NULL DEFAULT '',
1445
`DB` varchar(64) NOT NULL DEFAULT '',
1514
`HOST` varchar(64) NOT NULL DEFAULT '',
1515
`DB` varchar(64) DEFAULT NULL,
1446
1516
`COMMAND` varchar(16) NOT NULL DEFAULT '',
1447
1517
`TIME` bigint NOT NULL DEFAULT '0',
1448
`STATE` varchar(64) NOT NULL DEFAULT '',
1449
`INFO` varchar(100) NOT NULL DEFAULT ''
1518
`STATE` varchar(64) DEFAULT NULL,
1452
create temporary table t1 like data_dictionary.processlist;
1453
ERROR HY000: Can't create table 'test.#t1' (errno: 138)
1454
create temporary table t1 like data_dictionary.processlist engine=myisam;
1522
create temporary table t1 like information_schema.processlist;
1455
1523
show create table t1;
1456
1524
Table Create Table
1457
1525
t1 CREATE TEMPORARY TABLE `t1` (
1458
1526
`ID` bigint NOT NULL DEFAULT '0',
1459
1527
`USER` varchar(16) NOT NULL DEFAULT '',
1460
`HOST` varchar(1025) NOT NULL DEFAULT '',
1461
`DB` varchar(64) NOT NULL DEFAULT '',
1528
`HOST` varchar(64) NOT NULL DEFAULT '',
1529
`DB` varchar(64) DEFAULT NULL,
1462
1530
`COMMAND` varchar(16) NOT NULL DEFAULT '',
1463
1531
`TIME` bigint NOT NULL DEFAULT '0',
1464
`STATE` varchar(64) NOT NULL DEFAULT '',
1465
`INFO` varchar(100) NOT NULL DEFAULT ''
1532
`STATE` varchar(64) DEFAULT NULL,
1466
1534
) ENGINE=MyISAM
1490
1558
`c2` int DEFAULT NULL COMMENT 'column2',
1491
1559
`c3` int NOT NULL COMMENT 'column3',
1492
1560
`c4` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT 'a',
1493
`c5` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'b',
1561
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
1494
1562
`c6` varchar(255) COLLATE utf8_bin DEFAULT NULL
1495
1563
) ENGINE=DEFAULT
1502
1570
`c1` int DEFAULT '12' COMMENT 'column1',
1503
1571
`c2` int DEFAULT NULL COMMENT 'column2',
1504
1572
`c3` int NOT NULL COMMENT 'column3',
1505
`c4` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT 'a',
1506
`c5` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'b',
1507
`c6` varchar(255) COLLATE utf8_bin DEFAULT NULL
1573
`c4` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'a',
1574
`c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b',
1575
`c6` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
1508
1576
) ENGINE=DEFAULT