2
# Check some special create statements.
6
drop table if exists t1,t2,t3,t4,t5;
7
drop database if exists mysqltest;
10
create table t1 (b char(0));
11
insert into t1 values (""),(null);
13
drop table if exists t1;
15
create table t1 (b char(0) not null);
16
create table if not exists t1 (b char(0) not null);
17
--error ER_BAD_NULL_ERROR
18
insert into t1 values (""),(null);
22
create temporary table t1 (a int not null auto_increment,primary key (a)) engine=MEMORY;
26
# Test of some CREATE TABLE'S that should fail
29
--error ER_TABLE_UNKNOWN
30
create temporary table t2 engine=MEMORY select * from t1;
31
--error ER_TABLE_UNKNOWN
32
create table t2 select auto+1 from t1;
33
drop table if exists t1,t2;
34
--error ER_WRONG_KEY_COLUMN
35
create table t1 (b char(0) not null, index(b));
36
--error ER_TABLE_CANT_HANDLE_BLOB
37
create temporary table t1 (a int not null,b text) engine=MEMORY;
38
drop table if exists t1;
40
--error ER_WRONG_AUTO_KEY
41
create temporary table t1 (ordid int not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) engine=MEMORY;
43
create table not_existing_database.test (a int);
44
create table `a/a` (a int);
45
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
46
show create table `a/a`;
47
create table t1 like `a/a`;
48
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
50
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
51
show create table `t1`;
54
--error ER_WRONG_TABLE_NAME
55
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
56
--error ER_TOO_LONG_IDENT
57
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
60
# Some wrong defaults, so these creates should fail too (Bug #5902)
62
--error ER_INVALID_DEFAULT
63
create table t1 (a datetime default now());
64
--error ER_INVALID_ON_UPDATE
65
create table t1 (a datetime on update now());
66
--error ER_INVALID_DEFAULT
67
create table t1 (a int default 100 auto_increment);
68
# TODO: Should this really fail? What's wrong with default 1000 ???
69
#--error ER_INVALID_DEFAULT
70
#create table t1 (a int default 1000);
71
--error ER_INVALID_DEFAULT
72
create table t1 (a varchar(5) default 'abcdef');
74
create table t1 (a varchar(5) default 'abcde');
75
insert into t1 values();
77
--error ER_INVALID_DEFAULT
78
alter table t1 alter column a set default 'abcdef';
82
# test of dummy table names
85
create table 1ea10 (1a20 int,1e int);
86
insert into 1ea10 values(1,1);
87
select 1ea10.1a20,1e+ 1e+10 from 1ea10;
89
create table t1 (t1.index int);
91
# Test that we get warning for this
92
drop database if exists mysqltest;
93
create database mysqltest;
94
create table mysqltest.$test1 (a$1 int, $b int, c$ int);
95
insert into mysqltest.$test1 values (1,2,3);
96
select a$1, $b, c$ from mysqltest.$test1;
97
create table mysqltest.test2$ (a int);
98
drop table mysqltest.test2$;
99
drop database mysqltest;
101
--error ER_WRONG_TABLE_NAME
102
create table `` (a int);
103
--error ER_WRONG_TABLE_NAME
104
drop table if exists ``;
105
--error ER_WRONG_COLUMN_NAME
106
create table t1 (`` int);
107
--error ER_WRONG_NAME_FOR_INDEX
108
create table t1 (i int, index `` (i));
111
# Test of CREATE ... SELECT with indexes
114
create table t1 (a int auto_increment not null primary key, B CHAR(20));
115
insert into t1 (b) values ("hello"),("my"),("world");
116
create table t2 (key (b)) select * from t1;
117
explain select * from t2 where b="world";
118
select * from t2 where b="world";
122
# Test types after CREATE ... SELECT
125
create table t1(x varchar(50) );
126
create table t2 select x from t1 where 1=2;
130
create table t2 select now() as a , curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f;
133
create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("2001-12-29 20:45:11" AS DATETIME) as dt;
138
# Test of CREATE ... SELECT with duplicate fields
141
create table t1 (a int);
142
create table t2 (a int) select * from t1;
145
drop table if exists t2;
146
--error ER_DUP_FIELDNAME
147
create table t2 (a int, a float) select * from t1;
148
drop table if exists t2;
149
--error ER_DUP_FIELDNAME
150
create table t2 (a int) select a as b, a+1 as b from t1;
151
drop table if exists t2;
152
--error ER_DUP_FIELDNAME
153
create table t2 (b int) select a as b, a+1 as b from t1;
154
drop table if exists t1,t2;
157
# Test CREATE ... SELECT when insert fails
160
CREATE TABLE t1 (a int not null);
161
INSERT INTO t1 values (1),(2),(1);
163
CREATE TABLE t2 (primary key(a)) SELECT * FROM t1;
164
--error ER_TABLE_UNKNOWN
167
DROP TABLE IF EXISTS t2;
170
# Test of primary key with 32 index
173
create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b));
174
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
175
show create table t1;
177
create table t1 select if(1,'1','0'), month("2002-08-02");
179
create table t1 select if('2002'='2002','Y','N');
181
drop table if exists t1;
184
# Test default table type
186
SET SESSION storage_engine="MEMORY";
187
SELECT @@storage_engine;
188
CREATE TEMPORARY TABLE t1 (a int not null);
189
show create table t1;
191
--error ER_UNKNOWN_STORAGE_ENGINE
192
SET SESSION storage_engine="gemini";
193
SELECT @@storage_engine;
194
CREATE TEMPORARY TABLE t1 (a int not null);
195
show create table t1;
196
SET SESSION storage_engine=default;
201
# ISO requires that primary keys are implicitly NOT NULL
203
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
204
insert into t1 values ("a", 1), ("b", 2);
205
--error ER_BAD_NULL_ERROR
206
insert into t1 values ("c", NULL);
207
--error ER_BAD_NULL_ERROR
208
insert into t1 values (NULL, 3);
209
--error ER_BAD_NULL_ERROR
210
insert into t1 values (NULL, NULL);
217
create table t1 select x'4132';
224
create table t1 select 1,2,3;
225
--error ER_NO_DEFAULT_FOR_FIELD
226
create table if not exists t1 select 1,2;
227
--error ER_WRONG_VALUE_COUNT_ON_ROW
228
create table if not exists t1 select 1,2,3,4;
229
--error ER_NO_DEFAULT_FOR_FIELD
230
create table if not exists t1 select 1;
235
# Test create table if not exists with duplicate key error
239
create table t1 (a int not null, b int, primary key (a));
240
insert into t1 values (1,1);
241
# TODO: BUG here, this is filling in right to left for some reason
242
#create table if not exists t1 select 2;
244
create table if not exists t1 select 3 as 'a',4 as 'b';
246
create table if not exists t1 select 3 as 'a',3 as 'b';
248
--replace_column 3 # 4 # 5 #
249
select * from DATA_DICTIONARY.TABLE_DEFINITION_CACHE WHERE TABLE_COUNT AND TABLE_SCHEMA = SCHEMA() > 1 ORDER BY TABLE_SCHEMA, TABLE_NAME;
255
# "Table truncated when creating another table name with Spaces"
258
--error ER_WRONG_TABLE_NAME
259
create table `t1 `(a int);
260
--error ER_WRONG_DB_NAME
261
create database `db1 `;
262
--error ER_WRONG_COLUMN_NAME
263
create table t1(`a ` int);
267
# "Parser permits multiple commas without syntax error"
270
--error ER_PARSE_ERROR
271
create table t1 (a int,);
272
--error ER_PARSE_ERROR
273
create table t1 (a int,,b int);
274
--error ER_PARSE_ERROR
275
create table t1 (,b int);
278
# Test create with foreign keys
281
create table t1 (a int, key(a));
282
create table t2 (b int, foreign key(b) references t1(a), key(b));
283
--error ER_ROW_IS_REFERENCED
284
drop table if exists t1,t2;
285
drop table if exists t2,t1;
288
# Test for CREATE TABLE .. LIKE ..
291
create table t1(id int not null, name char(20));
292
insert into t1 values(10,'mysql'),(20,'monty- the creator');
293
create table t2(id int not null);
294
insert into t2 values(10),(20);
295
create table t3 like t1;
296
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
297
show create table t3;
299
# Disable PS becasue of @@warning_count
300
create table if not exists t3 like t1;
301
--disable_ps_protocol
302
select @@warning_count;
304
create temporary table t3 like t2;
305
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
306
show create table t3;
309
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
310
show create table t3;
313
create database mysqltest;
314
create table mysqltest.t3 like t1;
315
create temporary table t3 like mysqltest.t3;
317
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
318
show create table t3;
320
create table t2 like t3;
322
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
323
show create table t2;
326
--error ER_TABLE_EXISTS_ERROR
327
create table t3 like t1;
329
--error ER_TABLE_EXISTS_ERROR
330
create table t3 like mysqltest.t3;
332
--error ER_BAD_DB_ERROR
333
create table non_existing_database.t1 like t1;
335
--error ER_TABLE_UNKNOWN
336
create table t4 like non_existing_table;
338
--error ER_TABLE_EXISTS_ERROR
339
create temporary table t3 like t1;
340
drop table t1, t2, t3;
341
drop database mysqltest;
344
# Test default table type
346
SET SESSION storage_engine="MEMORY";
347
SELECT @@storage_engine;
348
CREATE TEMPORARY TABLE t1 (a int not null);
349
show create table t1;
351
--error ER_UNKNOWN_STORAGE_ENGINE
352
SET SESSION storage_engine="gemini";
353
SELECT @@storage_engine;
354
CREATE TEMPORARY TABLE t1 (a int not null);
355
show create table t1;
356
SET SESSION storage_engine=default;
360
# Test types of data for create select with functions
363
create table t1(a int,b int,c int,d date,e char,f datetime,h blob);
364
insert into t1(a)values(1);
365
insert into t1(a,b,c,d,e,f,h)
366
values(2,-2,2,'1825-12-14','a','2003-01-01 03:02:01','binary data');
371
ifnull(d,cast('2000-01-01' as date)) as d,
372
ifnull(e,cast('b' as char)) as e,
373
ifnull(f,cast('2000-01-01' as datetime)) as f,
374
ifnull(h,cast('yet another binary data' as binary)) as h
382
ifnull(d,cast('2000-01-01' as date)) as d,
383
ifnull(e,cast('b' as char)) as e,
384
ifnull(f,cast('2000-01-01' as datetime)) as f,
385
ifnull(h,cast('yet another binary data' as binary)) as h
391
create table t1 (a int, b int, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), j date, k timestamp, l datetime, m enum('a','b'), o char(10));
392
SHOW CREATE TABLE t1;
393
create table t2 select ifnull(a,a), ifnull(b,b), ifnull(d,d), ifnull(e,e), ifnull(f,f), ifnull(g,g), ifnull(h,h), ifnull(j,j), ifnull(k,k), ifnull(l,l), ifnull(m,m), ifnull(o,o) from t1;
394
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
395
show create table t2;
401
create table t1(str varchar(10) default 'def',strnull varchar(10),intg int default '10',rel double default '3.14');
402
insert into t1 values ('','',0,0.0);
404
create table t2 select default(str) as str, default(strnull) as strnull, default(intg) as intg, default(rel) as rel from t1;
412
create table t1(name varchar(10), age int default -1);
414
create table t2(name varchar(10), age int default - 1);
419
# test for bug #1427 "enum allows duplicate values in the list"
422
create table t1(cenum enum('a'));
423
--error ER_DUPLICATED_VALUE_IN_TYPE
424
create table t2(cenum enum('a','a'));
425
--error ER_DUPLICATED_VALUE_IN_TYPE
426
create table t3(cenum enum('a','A','a','c','c'));
433
create database mysqltest;
436
drop database mysqltest;
441
# Test for Bug 856 'Naming a key "Primary" causes trouble'
444
## TODO: Is this really a bug? It works in Drizzle. Should it?
445
#--error ER_WRONG_NAME_FOR_INDEX
446
#create table t1 (a int, index `primary` (a));
447
#--error ER_WRONG_NAME_FOR_INDEX
448
#create table t1 (a int, index `PRIMARY` (a));
450
#create table t1 (`primary` int, index(`primary`));
451
#--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
452
#show create table t1;
453
#create table t2 (`PRIMARY` int, index(`PRIMARY`));
454
#--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
455
#show create table t2;
457
#create table t3 (a int);
458
#--error ER_WRONG_NAME_FOR_INDEX
459
#alter table t3 add index `primary` (a);
460
#--error ER_WRONG_NAME_FOR_INDEX
461
#alter table t3 add index `PRIMARY` (a);
463
#create table t4 (`primary` int);
464
#alter table t4 add index(`primary`);
465
#--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
466
#show create table t4;
467
#create table t5 (`PRIMARY` int);
468
#alter table t5 add index(`PRIMARY`);
469
#--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
470
#show create table t5;
472
#drop table t1, t2, t3, t4, t5;
475
# bug #3266 TEXT in CREATE TABLE SELECT
478
CREATE TABLE t1(id varchar(10) NOT NULL PRIMARY KEY, dsc longtext);
479
INSERT INTO t1 VALUES ('5000000001', NULL),('5000000003', 'Test'),('5000000004', NULL);
480
CREATE TABLE t2(id varchar(15) NOT NULL, proc varchar(100) NOT NULL, runID varchar(16) NOT NULL, start datetime NOT NULL, PRIMARY KEY (id,proc,runID,start));
482
INSERT INTO t2 VALUES ('5000000001', 'proc01', '20031029090650', '2003-10-29 13:38:40'),('5000000001', 'proc02', '20031029090650', '2003-10-29 13:38:51'),('5000000001', 'proc03', '20031029090650', '2003-10-29 13:38:11'),('5000000002', 'proc09', '20031024013310', '2003-10-24 01:33:11'),('5000000002', 'proc09', '20031024153537', '2003-10-24 15:36:04'),('5000000004', 'proc01', '20031024013641', '2003-10-24 01:37:29'),('5000000004', 'proc02', '20031024013641', '2003-10-24 01:37:39');
484
CREATE TABLE t3 SELECT t1.dsc,COUNT(DISTINCT t2.id) AS countOfRuns FROM t1 LEFT JOIN t2 ON (t1.id=t2.id) GROUP BY t1.id;
486
drop table t1, t2, t3;
490
# Bug#10224 - ANALYZE TABLE crashing with simultaneous
491
# CREATE ... SELECT statement.
492
# This tests two additional possible errors and a hang if
493
# an improper fix is present.
495
create table t1 (a int);
496
--error ER_UPDATE_TABLE_USED
497
create table t1 select * from t1;
498
## TODO: Huh? --error ER_WRONG_OBJECT
499
#create table t2 union = (t1) select * from t1;
500
flush tables with read lock;
505
# Bug#10413: Invalid column name is not rejected
507
--error ER_WRONG_TABLE_NAME
508
create table t1(column.name int);
509
--error ER_WRONG_TABLE_NAME
510
create table t1(test.column.name int);
511
--error ER_WRONG_DB_NAME
512
create table t1(xyz.t1.name int);
513
create table t1(t1.name int);
514
create table t2(test.t2.name int);
518
# Bug #12537: UNION produces longtext instead of varchar
520
CREATE TABLE t1 (f1 VARCHAR(255));
521
CREATE TABLE t2 AS SELECT LEFT(f1,171) AS f2 FROM t1 UNION SELECT LEFT(f1,171) AS f2 FROM t1;
526
# Bug#12913 Simple SQL can crash server or connection
528
CREATE TABLE t12913 (f1 ENUM ('a','b')) AS SELECT 'a' AS f1;
529
SELECT * FROM t12913;
533
# Bug#11028: Crash on create table like
535
create database mysqltest;
537
drop database mysqltest;
538
--error ER_NO_DB_ERROR
539
create table test.t1 like x;
541
drop table if exists test.t1;
544
# Bug #6008 MySQL does not create warnings when
545
# creating database and using IF NOT EXISTS
547
create database mysqltest;
548
create database if not exists mysqltest;
549
show create database mysqltest;
550
drop database mysqltest;
552
create table t1 (a int);
553
create table if not exists t1 (a int);
558
a varchar(112) collate utf8_bin not null,
560
) select 'test' as a ;
562
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
563
show create table t1;
567
# BUG#14480: assert failure in CREATE ... SELECT because of wrong
568
# calculation of number of NULLs.
573
insert into t2 values(111);
577
a varchar(12) collate utf8_bin not null,
578
b int not null, primary key (a)
579
) select a, 1 as b from t2 ;
580
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
581
show create table t1;
584
--error ER_NO_DEFAULT_FOR_FIELD
586
a varchar(12) collate utf8_bin not null,
587
b int not null, primary key (a)
588
) select a, 1 as c from t2 ;
591
a varchar(12) collate utf8_bin not null,
592
b int null, primary key (a)
593
) select a, 1 as c from t2 ;
594
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
595
show create table t1;
599
a varchar(12) collate utf8_bin not null,
600
b int not null, primary key (a)
601
) select 'a' as a , 1 as b from t2 ;
602
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
603
show create table t1;
607
a varchar(12) collate utf8_bin,
608
b int not null, primary key (a)
609
) select 'a' as a , 1 as b from t2 ;
610
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
611
show create table t1;
616
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
618
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
622
a1 varchar(12) collate utf8_bin not null,
623
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
625
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
630
a1 varchar(12) collate utf8_bin,
631
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
632
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;
637
a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
639
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
643
a1 varchar(12) collate utf8_bin not null,
644
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
646
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
648
# Test the default value
651
create table t2 ( a int default 3, b int default 3)
652
select a1,a2 from t1;
653
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
654
show create table t2;
660
# Tests for errors happening at various stages of CREATE TABLES ... SELECT
662
# (Also checks that it behaves atomically in the sense that in case
663
# of error it is automatically dropped if it has not existed before.)
665
# Error during open_and_lock_tables() of tables
666
--error ER_TABLE_UNKNOWN
667
create table t1 select * from t2;
668
# Rather special error which also caught during open tables pahse
669
--error ER_UPDATE_TABLE_USED
670
create table t1 select * from t1;
671
# Error which happens before select_create::prepare()
672
--error ER_CANT_AGGREGATE_2COLLATIONS
673
create table t1 select coalesce('a' collate utf8_swedish_ci,'b' collate utf8_bin);
674
# Error during table creation
675
--error ER_KEY_COLUMN_DOES_NOT_EXITS
676
create table t1 (primary key(a)) select "b" as b;
677
# Error in select_create::prepare() which is not related to table creation
678
# TODO: This really should be failing...
679
# create table t1 (a int);
680
# --error ER_WRONG_VALUE_COUNT_ON_ROW
681
# create table if not exists t1 select 1 as a, 2 as b;
683
# Finally error which happens during insert
685
create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
686
# What happens if table already exists ?
687
create table t1 (i int);
688
# TODO: BUG lp:311045
689
#--error ER_TABLE_EXISTS_ERROR
690
#create table t1 select 1 as i;
691
create table if not exists t1 select 1 as i;
694
# Error before select_create::prepare()
695
--error ER_CANT_AGGREGATE_2COLLATIONS
696
create table t1 select coalesce('a' collate utf8_swedish_ci,'b' collate utf8_bin);
697
# Error which happens during insertion of rows
698
# TODO: Bug lp:311072
699
# create table t1 (i int);
700
# alter table t1 add primary key (i);
701
# --error ER_DUP_ENTRY
702
# create table if not exists t1 (select 2 as i) union all (select 2 as i);
707
# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
708
# results of CREATE TABLE ... SELECT when temporary table exists").
709
# In this situation we either have to create non-temporary table and
710
# insert data in it or insert data in temporary table without creation
711
# of permanent table. Since currently temporary tables always shadow
712
# permanent tables we adopt second approach.
713
create temporary table t1 (j int);
714
create table if not exists t1 select 1;
716
drop temporary table t1;
717
--error ER_TABLE_UNKNOWN
719
--error ER_BAD_TABLE_ERROR
724
# Bug#21772: can not name a column 'upgrade' when create a table
726
create table t1 (upgrade int);
731
# Bug #26642: create index corrupts table definition in .frm
733
# Problem with creating keys with maximum key-parts and maximum name length
734
# This test is made for a mysql server supporting names up to 64 bytes
735
# and a maximum of 16 key segements per Key
739
c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int,
740
c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int,
742
key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
743
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
744
key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
745
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
746
key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
747
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
748
key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
749
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
750
key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
751
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
752
key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
753
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
754
key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
755
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
756
key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
757
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
758
key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
759
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
761
key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
762
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
763
key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
764
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
765
key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
766
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
767
key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
768
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
769
key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
770
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
771
key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
772
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
773
key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
774
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
775
key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
776
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
777
key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
778
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
779
key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
780
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
782
key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
783
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
784
key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
785
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
786
key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
787
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
788
key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
789
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
790
key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
791
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
792
key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
793
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
794
key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
795
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
796
key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
797
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
798
key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
799
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
800
key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
801
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
803
key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
804
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
805
key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
806
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
807
key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
808
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
809
key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
810
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
811
key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
812
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
813
key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
814
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
815
key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
816
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
817
key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
818
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
819
key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
820
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
821
key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
822
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
824
key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
825
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
826
key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
827
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
828
key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
829
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
830
key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
831
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
832
key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
833
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
834
key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
835
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
836
key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
837
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
838
key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
839
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
840
key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
841
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
842
key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
843
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
845
key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
846
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
847
key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
848
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
849
key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
850
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
851
key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
852
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
853
key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
854
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
855
key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
856
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
857
key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
858
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
859
key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
860
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
861
key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
862
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
863
key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
864
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
866
key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
867
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
868
key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
869
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
870
key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
871
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
872
key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
873
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
874
key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
875
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16)
878
# Check that the table is not corrupted
879
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
880
show create table t1;
882
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
883
show create table t1;
885
# Repeat test using ALTER to add indexes
888
create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
889
c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
893
add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
894
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
895
add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
896
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
897
add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
898
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
899
add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
900
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
901
add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
902
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
903
add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
904
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
905
add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
906
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
907
add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
908
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
909
add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
910
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
912
add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
913
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
914
add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
915
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
916
add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
917
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
918
add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
919
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
920
add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
921
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
922
add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
923
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
924
add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
925
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
926
add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
927
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
928
add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
929
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
930
add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
931
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
933
add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
934
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
935
add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
936
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
937
add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
938
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
939
add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
940
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
941
add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
942
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
943
add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
944
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
945
add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
946
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
947
add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
948
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
949
add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
950
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
951
add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
952
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
954
add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
955
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
956
add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
957
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
958
add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
959
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
960
add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
961
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
962
add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
963
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
964
add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
965
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
966
add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
967
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
968
add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
969
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
970
add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
971
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
972
add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
973
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
975
add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
976
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
977
add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
978
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
979
add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
980
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
981
add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
982
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
983
add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
984
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
985
add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
986
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
987
add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
988
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
989
add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
990
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
991
add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
992
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
993
add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
994
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
996
add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
997
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
998
add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
999
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1000
add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
1001
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1002
add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
1003
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1004
add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
1005
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1006
add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
1007
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1008
add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
1009
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1010
add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
1011
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1012
add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
1013
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1014
add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
1015
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1017
add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
1018
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1019
add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
1020
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1021
add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
1022
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1023
add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
1024
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
1025
add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
1026
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
1028
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1029
show create table t1;
1031
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1032
show create table t1;
1034
# Test the server limits; if any of these pass, all above tests need
1035
# to be rewritten to hit the limit
1037
# Ensure limit is really 64 keys
1038
--error ER_TOO_MANY_KEYS
1039
alter table t1 add key
1040
a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
1041
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
1045
# Ensure limit is really 16 key parts per key
1047
create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
1048
c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int,
1051
# Get error for max key parts
1052
--error ER_TOO_MANY_KEY_PARTS
1053
alter table t1 add key i1 (
1054
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17);
1056
# Get error for max key-name length
1057
--error ER_TOO_LONG_IDENT
1058
alter table t1 add key
1059
a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
1061
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1062
show create table t1;
1067
--echo Bug #26104 Bug on foreign key class constructor
1069
--echo Check that ref_columns is initalized correctly in the constructor
1070
--echo and semantic checks in mysql_prepare_table work.
1072
--echo We do not need a storage engine that supports foreign keys
1073
--echo for this test, as the checks are purely syntax-based, and the
1074
--echo syntax is supported for all engines.
1077
drop table if exists t1,t2;
1080
create table t1(a int not null, b int not null, primary key (a, b));
1081
--error ER_WRONG_FK_DEF
1082
create table t2(a int not null, b int not null, c int not null, primary key (a),
1083
foreign key fk_bug26104 (b,c) references t1(a));
1087
# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
1089
create table t1(f1 int,f2 int);
1090
insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
1092
create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
1093
show status like 'handler_read%';
1097
# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates
1100
# Show that the old syntax for index type is supported
1101
CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
1104
# Show that the new syntax for index type is supported
1105
CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
1108
# Show that in case of multiple index type definitions, the last one takes
1111
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
1112
#SHOW INDEX FROM t1;
1115
CREATE TEMPORARY TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
1116
#SHOW INDEX FROM t1;
1120
--echo End of 5.0 tests
1123
# Test of behaviour with CREATE ... SELECT
1126
CREATE TABLE t1 (a int, b int);
1127
insert into t1 values (1,1),(1,2);
1128
--error ER_DUP_ENTRY
1129
CREATE TABLE t2 (primary key (a)) select * from t1;
1130
# This should give warning
1131
drop table if exists t2;
1132
--error ER_DUP_ENTRY
1133
CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
1134
# This should give warning
1135
drop table if exists t2;
1136
# TODO: Bug lp:311072
1137
#CREATE TABLE t2 (a int, b int, primary key (a));
1138
#--error ER_DUP_ENTRY
1139
#CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
1142
#--error ER_DUP_ENTRY
1143
#INSERT INTO t2 select * from t1;
1147
CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
1148
--error ER_DUP_ENTRY
1149
CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
1152
--error ER_DUP_ENTRY
1153
INSERT INTO t2 select * from t1;
1159
# Test incorrect database names
1162
--error ER_WRONG_DB_NAME
1163
CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1164
--error ER_WRONG_DB_NAME
1165
DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1167
# TODO: enable these tests when RENAME DATABASE is implemented.
1168
# --error ER_BAD_DB_ERROR
1169
# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
1170
# --error ER_WRONG_DB_NAME
1171
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1172
# create database mysqltest;
1173
# --error ER_WRONG_DB_NAME
1174
# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1175
# drop database mysqltest;
1177
--error ER_WRONG_DB_NAME
1178
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1179
#--error ER_WRONG_DB_NAME
1180
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
1183
## Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte
1186
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1187
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1191
select SCHEMA_NAME from data_dictionary.schemas
1192
where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45';
1194
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
1195
create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48
1197
имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int,
1198
index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45)
1202
# database, table, field, key
1203
select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1205
select TABLE_NAME from data_dictionary.tables where
1206
table_schema='test';
1208
select COLUMN_NAME from data_dictionary.columns where
1209
table_schema='test';
1211
select INDEX_NAME from data_dictionary.indexes where
1212
table_schema='test';
1214
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1215
show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1217
drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48;
1221
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
1223
--error ER_CANT_CREATE_TABLE,ER_TABLE_PERMISSION_DENIED
1224
create table t1 like data_dictionary.processlist;
1225
create table t1 like data_dictionary.processlist engine=innodb;
1226
show create table t1;
1228
--error ER_CANT_CREATE_TABLE,ER_TABLE_PERMISSION_DENIED
1229
create temporary table t1 like data_dictionary.processlist;
1230
create temporary table t1 like data_dictionary.processlist engine=myisam;
1231
show create table t1;
1234
###########################################################################
1238
--echo # -- Bug#21380: DEFAULT definition not always transfered by CREATE
1239
--echo # -- TABLE/SELECT to the new table.
1245
DROP TABLE IF EXISTS t1;
1246
DROP TABLE IF EXISTS t2;
1252
c1 INT DEFAULT 12 COMMENT 'column1',
1253
c2 INT NULL COMMENT 'column2',
1254
c3 INT NOT NULL COMMENT 'column3',
1255
c4 VARCHAR(255) NOT NULL DEFAULT 'a',
1256
c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b',
1262
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1263
SHOW CREATE TABLE t1;
1267
CREATE TABLE t2 AS SELECT * FROM t1;
1271
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
1272
SHOW CREATE TABLE t2;
1279
--echo # -- End of test case for Bug#21380.
1281
###########################################################################
1285
--echo # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields
1290
DROP TABLE IF EXISTS t1;
1291
DROP TABLE IF EXISTS t2;
1292
DROP TABLE IF EXISTS t3;
1297
CREATE TABLE t1(c1 TIMESTAMP, c2 TIMESTAMP);
1302
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP NULL);
1305
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP DEFAULT '1982-01-29');
1309
CREATE TABLE t2(c1 TIMESTAMP, c2 TIMESTAMP);
1313
--echo # -- Check that NULL column still can be created.
1314
CREATE TABLE t2(c1 TIMESTAMP NULL);
1317
--echo # -- Check ALTER TABLE.
1318
ALTER TABLE t1 ADD INDEX(c1);
1321
--echo # -- Check DATETIME.
1324
CREATE TABLE t3(c1 DATETIME NOT NULL);
1325
--error ER_INVALID_DATETIME_VALUE # Bad datetime
1326
INSERT INTO t3 VALUES (0);
1329
ALTER TABLE t3 ADD INDEX(c1);
1332
--echo # -- Cleanup.
1339
--echo # -- End of Bug#18834.