50
50
PRIMARY KEY (GROUP_ID,LANG_ID),
52
52
ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null;
54
Field Type Null Default Default_is_NULL On_Update
55
GROUP_ID INTEGER FALSE 0 FALSE
56
LANG_ID INTEGER FALSE 0 FALSE
57
NAME VARCHAR FALSE FALSE
53
SHOW FULL COLUMNS FROM t1;
54
Field Type Collation Null Key Default Extra Privileges Comment
55
GROUP_ID int NULL NO PRI NULL #
56
LANG_ID int NULL NO PRI NULL #
57
NAME varchar(80) utf8_general_ci NO MUL NULL #
59
59
create table t1 (n int);
60
60
insert into t1 values(9),(3),(12),(10);
78
78
ALTER TABLE t1 ORDER BY t1.id, t1.status, t1.type_id, t1.user_id, t1.body;
80
CREATE TABLE t1 (AnamneseId int NOT NULL auto_increment,B BLOB,PRIMARY KEY (AnamneseId)) engine=myisam;
81
insert into t1 values (null,"hello");
83
ALTER TABLE t1 ADD Column new_col int not null;
86
Table Op Msg_type Msg_text
87
test.t1 optimize status OK
80
89
create table t1 (i int not null auto_increment primary key);
81
90
insert into t1 values (null),(null),(null),(null);
82
91
alter table t1 drop i,add i int not null auto_increment, drop primary key, add primary key (i);
116
125
key (n4, n1, n2, n3) );
118
127
show keys from t1;
119
Table Unique Key_name Seq_in_index Column_name
128
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
129
t1 0 n1 1 n1 A 0 NULL NULL BTREE
130
t1 1 n1_2 1 n1 A 0 NULL NULL BTREE
131
t1 1 n1_2 2 n2 A 0 NULL NULL YES BTREE
132
t1 1 n1_2 3 n3 A 0 NULL NULL YES BTREE
133
t1 1 n1_2 4 n4 A 0 NULL NULL YES BTREE
134
t1 1 n2 1 n2 A 0 NULL NULL YES BTREE
135
t1 1 n2 2 n3 A 0 NULL NULL YES BTREE
136
t1 1 n2 3 n4 A 0 NULL NULL YES BTREE
137
t1 1 n2 4 n1 A 0 NULL NULL BTREE
138
t1 1 n3 1 n3 A 0 NULL NULL YES BTREE
139
t1 1 n3 2 n4 A 0 NULL NULL YES BTREE
140
t1 1 n3 3 n1 A 0 NULL NULL BTREE
141
t1 1 n3 4 n2 A 0 NULL NULL YES BTREE
142
t1 1 n4 1 n4 A 0 NULL NULL YES BTREE
143
t1 1 n4 2 n1 A 0 NULL NULL BTREE
144
t1 1 n4 3 n2 A 0 NULL NULL YES BTREE
145
t1 1 n4 4 n3 A 0 NULL NULL YES BTREE
137
146
set autocommit=0;
139
148
insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
153
162
Note 1031 Table storage engine for 't1' doesn't have this option
154
163
show keys from t1;
155
Table Unique Key_name Seq_in_index Column_name
164
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
165
t1 0 n1 1 n1 A 2 NULL NULL BTREE
166
t1 1 n1_2 1 n1 A 2 NULL NULL BTREE
167
t1 1 n1_2 2 n2 A 2 NULL NULL YES BTREE
168
t1 1 n1_2 3 n3 A 2 NULL NULL YES BTREE
169
t1 1 n1_2 4 n4 A 2 NULL NULL YES BTREE
170
t1 1 n2 1 n2 A 2 NULL NULL YES BTREE
171
t1 1 n2 2 n3 A 2 NULL NULL YES BTREE
172
t1 1 n2 3 n4 A 2 NULL NULL YES BTREE
173
t1 1 n2 4 n1 A 2 NULL NULL BTREE
174
t1 1 n3 1 n3 A 2 NULL NULL YES BTREE
175
t1 1 n3 2 n4 A 2 NULL NULL YES BTREE
176
t1 1 n3 3 n1 A 2 NULL NULL BTREE
177
t1 1 n3 4 n2 A 2 NULL NULL YES BTREE
178
t1 1 n4 1 n4 A 2 NULL NULL YES BTREE
179
t1 1 n4 2 n1 A 2 NULL NULL BTREE
180
t1 1 n4 3 n2 A 2 NULL NULL YES BTREE
181
t1 1 n4 4 n3 A 2 NULL NULL YES BTREE
174
183
create table t1 (i int not null auto_increment primary key);
175
184
alter table t1 rename t2;
176
185
alter table t2 rename t1, add c char(10) comment "no comment";
177
186
show columns from t1;
178
Field Type Null Default Default_is_NULL On_Update
179
i INTEGER FALSE 0 FALSE
187
Field Type Null Key Default Extra
188
i int NO PRI NULL auto_increment
189
c varchar(10) YES NULL
182
191
create table t1 (a int, b int);
183
192
set autocommit=0;
286
295
set autocommit=1;
287
296
alter table t1 add unique (a,b), add key (b);
288
297
show keys from t1;
289
Table Unique Key_name Seq_in_index Column_name
298
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
299
t1 0 a 1 a A 6 NULL NULL YES BTREE
300
t1 0 a 2 b A 300 NULL NULL YES BTREE
301
t1 1 b 1 b A 300 NULL NULL YES BTREE
293
302
analyze table t1;
294
303
Table Op Msg_type Msg_text
295
304
test.t1 analyze status OK
296
305
show keys from t1;
297
Table Unique Key_name Seq_in_index Column_name
306
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
307
t1 0 a 1 a A 6 NULL NULL YES BTREE
308
t1 0 a 2 b A 300 NULL NULL YES BTREE
309
t1 1 b 1 b A 300 NULL NULL YES BTREE
302
CREATE TEMPORARY TABLE t1 (
303
Host varchar(16) NOT NULL default '',
304
User varchar(16) NOT NULL default '',
312
Host varchar(16) binary NOT NULL default '',
313
User varchar(16) binary NOT NULL default '',
314
PRIMARY KEY (Host,User)
316
ALTER TABLE t1 DISABLE KEYS;
317
LOCK TABLES t1 WRITE;
318
INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
320
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
321
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
322
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
323
ALTER TABLE t1 ENABLE KEYS;
326
Table Op Msg_type Msg_text
327
test.t1 check status OK
330
Host varchar(16) binary NOT NULL default '',
331
User varchar(16) binary NOT NULL default '',
305
332
PRIMARY KEY (Host,User),
308
335
ALTER TABLE t1 DISABLE KEYS;
337
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
338
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
339
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
340
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
341
LOCK TABLES t1 WRITE;
309
342
INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
344
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
345
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
346
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
347
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
310
348
ALTER TABLE t1 ENABLE KEYS;
350
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
351
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
352
t1 0 PRIMARY 2 User A 2 NULL NULL BTREE
353
t1 1 Host 1 Host A 1 NULL NULL BTREE
312
356
Table Op Msg_type Msg_text
313
357
test.t1 check status OK
358
LOCK TABLES t1 WRITE;
314
359
ALTER TABLE t1 RENAME t2;
315
361
select * from t2;
367
Host varchar(16) binary NOT NULL default '',
368
User varchar(16) binary NOT NULL default '',
369
PRIMARY KEY (Host,User),
372
LOCK TABLES t1 WRITE;
373
ALTER TABLE t1 DISABLE KEYS;
375
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
376
t1 0 PRIMARY 1 Host A NULL NULL NULL BTREE
377
t1 0 PRIMARY 2 User A 0 NULL NULL BTREE
378
t1 1 Host 1 Host A NULL NULL NULL BTREE disabled
320
380
create table t1 (a int);
321
381
alter table t1 rename to ``;
322
382
ERROR 42000: Incorrect table name ''
326
386
drop table if exists t1;
328
388
Note 1051 Unknown table 't1'
329
create TEMPORARY table t1 ( a varchar(10) not null primary key ) engine=myisam;
389
create table t1 ( a varchar(10) not null primary key ) engine=myisam;
331
391
alter table t1 modify a varchar(10);
333
393
alter table t1 modify a varchar(10) not null;
334
394
drop table if exists t1;
335
create TEMPORARY table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
336
insert into t1 (a,b,c,d,e,f,g,h,i) values(1,1,1,1,1,1,1,1,1);
395
create table t1 (a int, b int, c int, d int, e int, f int, g int, h int,i int, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
396
insert into t1 (a) values(1);
337
397
show table status like 't1';
338
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
339
# test t1 TEMPORARY MyISAM # # # # #
398
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
399
t1 MyISAM 10 Fixed 1 37 X X X X X X X X utf8_general_ci NULL
340
400
alter table t1 modify a int;
341
401
show table status like 't1';
342
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
343
# test t1 TEMPORARY MyISAM # # # # #
402
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
403
t1 MyISAM 10 Fixed 1 37 X X X X X X X X utf8_general_ci NULL
345
create TEMPORARY table t1 (a int not null default 0, b int not null default 0, c int not null default 0, d int not null default 0, e int not null default 0, f int not null default 0, g int not null default 0, h int not null default 0,i int not null default 0, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
405
create table t1 (a int not null default 0, b int not null default 0, c int not null default 0, d int not null default 0, e int not null default 0, f int not null default 0, g int not null default 0, h int not null default 0,i int not null default 0, primary key (a,b,c,d,e,f,g,i,h)) engine=MyISAM;
346
406
insert into t1 (a) values(1);
347
407
show table status like 't1';
348
Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
349
# test t1 TEMPORARY MyISAM # # # # #
408
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
409
t1 MyISAM 10 Fixed 1 37 X X X X X X X X utf8_general_ci NULL
351
411
CREATE TABLE t1 (a int PRIMARY KEY, b INT UNIQUE);
352
412
ALTER TABLE t1 DROP PRIMARY KEY;
377
437
drop table if exists t1;
378
438
create table t1 (a int, key(a));
379
439
show indexes from t1;
380
Table Unique Key_name Seq_in_index Column_name
440
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
441
t1 1 a 1 a A 0 NULL NULL YES BTREE
382
442
"this used not to disable the index"
383
443
alter table t1 modify a int;
384
444
show indexes from t1;
385
Table Unique Key_name Seq_in_index Column_name
445
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
446
t1 1 a 1 a A 0 NULL NULL YES BTREE
387
447
alter table t1 enable keys;
389
449
Note 1031 Table storage engine for 't1' doesn't have this option
390
450
show indexes from t1;
391
Table Unique Key_name Seq_in_index Column_name
451
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
452
t1 1 a 1 a A 0 NULL NULL YES BTREE
393
453
alter table t1 modify a bigint;
394
454
show indexes from t1;
395
Table Unique Key_name Seq_in_index Column_name
455
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
456
t1 1 a 1 a A 0 NULL NULL YES BTREE
397
457
alter table t1 enable keys;
399
459
Note 1031 Table storage engine for 't1' doesn't have this option
400
460
show indexes from t1;
401
Table Unique Key_name Seq_in_index Column_name
461
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
462
t1 1 a 1 a A 0 NULL NULL YES BTREE
403
463
alter table t1 add b char(10);
404
464
show indexes from t1;
405
Table Unique Key_name Seq_in_index Column_name
465
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
466
t1 1 a 1 a A 0 NULL NULL YES BTREE
407
467
alter table t1 add c decimal(10,2);
408
468
show indexes from t1;
409
Table Unique Key_name Seq_in_index Column_name
469
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
470
t1 1 a 1 a A 0 NULL NULL YES BTREE
411
471
"this however did"
413
473
show indexes from t1;
414
Table Unique Key_name Seq_in_index Column_name
474
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
475
t1 1 a 1 a A 0 NULL NULL YES BTREE
417
Field Type Null Default Default_is_NULL On_Update
477
Field Type Null Key Default Extra
478
a bigint YES MUL NULL
479
b varchar(10) YES NULL
480
c decimal(10,2) YES NULL
421
481
alter table t1 add d decimal(15,5);
422
482
"The key should still be disabled"
423
483
show indexes from t1;
424
Table Unique Key_name Seq_in_index Column_name
484
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
485
t1 1 a 1 a A 0 NULL NULL YES BTREE
427
487
"Now will test with one unique index"
428
488
create table t1(a int, b char(10), unique(a));
429
489
show indexes from t1;
430
Table Unique Key_name Seq_in_index Column_name
490
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
491
t1 0 a 1 a A 0 NULL NULL YES BTREE
433
493
show indexes from t1;
434
Table Unique Key_name Seq_in_index Column_name
494
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
495
t1 0 a 1 a A 0 NULL NULL YES BTREE
436
496
alter table t1 enable keys;
438
498
Note 1031 Table storage engine for 't1' doesn't have this option
440
500
"Unique index, no change"
441
501
alter table t1 modify a int;
442
502
show indexes from t1;
443
Table Unique Key_name Seq_in_index Column_name
503
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
504
t1 0 a 1 a A 0 NULL NULL YES BTREE
445
505
"Change the type implying data copy"
446
506
"Unique index, no change"
447
507
alter table t1 modify a bigint;
448
508
show indexes from t1;
449
Table Unique Key_name Seq_in_index Column_name
509
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
510
t1 0 a 1 a A 0 NULL NULL YES BTREE
451
511
alter table t1 modify a bigint;
452
512
show indexes from t1;
453
Table Unique Key_name Seq_in_index Column_name
513
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
514
t1 0 a 1 a A 0 NULL NULL YES BTREE
455
515
alter table t1 modify a int;
456
516
show indexes from t1;
457
Table Unique Key_name Seq_in_index Column_name
517
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
518
t1 0 a 1 a A 0 NULL NULL YES BTREE
460
520
"Now will test with one unique and one non-unique index"
461
521
create table t1(a int, b char(10), unique(a), key(b));
462
522
show indexes from t1;
463
Table Unique Key_name Seq_in_index Column_name
523
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
524
t1 0 a 1 a A 0 NULL NULL YES BTREE
525
t1 1 b 1 b A 0 NULL NULL YES BTREE
467
527
show indexes from t1;
468
Table Unique Key_name Seq_in_index Column_name
528
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
529
t1 0 a 1 a A 0 NULL NULL YES BTREE
530
t1 1 b 1 b A 0 NULL NULL YES BTREE
471
531
alter table t1 enable keys;
473
533
Note 1031 Table storage engine for 't1' doesn't have this option
475
535
"The non-unique index will be disabled"
476
536
alter table t1 modify a int;
477
537
show indexes from t1;
478
Table Unique Key_name Seq_in_index Column_name
538
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
539
t1 0 a 1 a A 0 NULL NULL YES BTREE
540
t1 1 b 1 b A 0 NULL NULL YES BTREE
481
541
alter table t1 enable keys;
483
543
Note 1031 Table storage engine for 't1' doesn't have this option
484
544
show indexes from t1;
485
Table Unique Key_name Seq_in_index Column_name
545
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
546
t1 0 a 1 a A 0 NULL NULL YES BTREE
547
t1 1 b 1 b A 0 NULL NULL YES BTREE
488
548
"Change the type implying data copy"
489
549
"The non-unique index will be disabled"
490
550
alter table t1 modify a bigint;
491
551
show indexes from t1;
492
Table Unique Key_name Seq_in_index Column_name
552
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
553
t1 0 a 1 a A 0 NULL NULL YES BTREE
554
t1 1 b 1 b A 0 NULL NULL YES BTREE
495
555
"Change again the type, but leave the indexes as_is"
496
556
alter table t1 modify a int;
497
557
show indexes from t1;
498
Table Unique Key_name Seq_in_index Column_name
558
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
559
t1 0 a 1 a A 0 NULL NULL YES BTREE
560
t1 1 b 1 b A 0 NULL NULL YES BTREE
501
561
"Try the same. When data is no copied on similar tables, this is noop"
502
562
alter table t1 modify a int;
503
563
show indexes from t1;
504
Table Unique Key_name Seq_in_index Column_name
564
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
565
t1 0 a 1 a A 0 NULL NULL YES BTREE
566
t1 1 b 1 b A 0 NULL NULL YES BTREE
508
568
create database mysqltest;
509
569
create table t1 (c1 int);
520
580
alter table test.t1 rename test.t1;
523
CREATE TABLE t1(a INT) ROW_FORMAT=COMPACT;
583
CREATE TABLE t1(a INT) ROW_FORMAT=FIXED;
524
584
CREATE INDEX i1 ON t1(a);
525
585
SHOW CREATE TABLE t1;
526
586
Table Create Table
527
587
t1 CREATE TABLE `t1` (
528
`a` int DEFAULT NULL,
530
) ENGINE=DEFAULT ROW_FORMAT=COMPACT
590
) ENGINE=InnoDB ROW_FORMAT=FIXED
531
591
DROP INDEX i1 ON t1;
532
592
SHOW CREATE TABLE t1;
533
593
Table Create Table
534
594
t1 CREATE TABLE `t1` (
536
) ENGINE=DEFAULT ROW_FORMAT=COMPACT
596
) ENGINE=InnoDB ROW_FORMAT=FIXED
538
598
DROP TABLE IF EXISTS bug24219;
539
599
DROP TABLE IF EXISTS bug24219_2;
540
600
CREATE TABLE bug24219 (a INT, INDEX(a));
541
601
SHOW INDEX FROM bug24219;
542
Table Unique Key_name Seq_in_index Column_name
602
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
603
bug24219 1 a 1 a A 0 NULL NULL YES BTREE
544
604
ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
546
606
Note 1031 Table storage engine for 'bug24219' doesn't have this option
547
607
SHOW INDEX FROM bug24219_2;
548
Table Unique Key_name Seq_in_index Column_name
549
bug24219_2 FALSE a 1 a
608
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
609
bug24219_2 1 a 1 a A 0 NULL NULL YES BTREE
550
610
DROP TABLE bug24219_2;
551
611
drop table if exists table_24562;
552
612
create table table_24562(
651
711
3 3 Stored Functions You
653
713
alter table table_24562 order by 12;
654
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '12' at line 1
714
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '12' at line 1
655
715
alter table table_24562 order by (section + 12);
656
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '(section + 12)' at line 1
716
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(section + 12)' at line 1
657
717
alter table table_24562 order by length(title);
658
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near '(title)' at line 1
718
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(title)' at line 1
659
719
alter table table_24562 order by no_such_col;
660
720
ERROR 42S22: Unknown column 'no_such_col' in 'order clause'
661
721
drop table table_24562;
662
722
create table t1 (mycol int not null);
663
723
alter table t1 alter column mycol set default 0;
665
Field Type Null Default Default_is_NULL On_Update
666
mycol INTEGER FALSE 0 FALSE
725
Field Type Null Key Default Extra
668
create TEMPORARY table t1(id int primary key auto_increment) engine=MEMORY;
728
create table t1(id int primary key auto_increment) engine=heap;
669
729
insert into t1 values (null);
670
730
insert into t1 values (null);
671
731
select * from t1;
847
drop table if exists t1, t2, t3;
848
create table t1 (i int);
849
create table t3 (j int);
850
insert into t1 values ();
851
insert into t3 values ();
852
lock table t1 write, t3 read;
853
alter table t1 modify i int default 1;
854
insert into t1 values ();
859
alter table t1 change i c char(10) default "Two";
860
insert into t1 values ();
866
alter table t1 modify c char(10) default "Three", rename to t2;
868
ERROR HY000: Table 't1' was not locked with LOCK TABLES
870
ERROR HY000: Table 't2' was not locked with LOCK TABLES
875
insert into t2 values ();
882
lock table t2 write, t3 read;
883
alter table t2 change c vc varchar(100) default "Four", rename to t1;
885
ERROR HY000: Table 't1' was not locked with LOCK TABLES
887
ERROR HY000: Table 't2' was not locked with LOCK TABLES
892
insert into t1 values ();
787
901
DROP TABLE IF EXISTS `t+1`, `t+2`;
788
902
CREATE TABLE `t+1` (c1 INT);
789
903
ALTER TABLE `t+1` RENAME `t+2`;
790
904
CREATE TABLE `t+1` (c1 INT);
791
905
ALTER TABLE `t+1` RENAME `t+2`;
792
ERROR 42S01: Table 'test.t+2' already exists
906
ERROR 42S01: Table 't+2' already exists
793
907
DROP TABLE `t+1`, `t+2`;
794
908
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
795
909
ALTER TABLE `tt+1` RENAME `tt+2`;
796
910
CREATE TEMPORARY TABLE `tt+1` (c1 INT);
797
911
ALTER TABLE `tt+1` RENAME `tt+2`;
798
ERROR 42S01: Table 'test.#tt+2' already exists
912
ERROR 42S01: Table 'tt+2' already exists
799
913
SHOW CREATE TABLE `tt+1`;
800
914
Table Create Table
801
915
tt+1 CREATE TEMPORARY TABLE `tt+1` (
802
`c1` int DEFAULT NULL
804
918
SHOW CREATE TABLE `tt+2`;
805
919
Table Create Table
806
920
tt+2 CREATE TEMPORARY TABLE `tt+2` (
807
`c1` int DEFAULT NULL
809
923
DROP TABLE `tt+1`, `tt+2`;
810
924
CREATE TEMPORARY TABLE `#sql1` (c1 INT);
811
925
CREATE TEMPORARY TABLE `@0023sql2` (c1 INT);
816
928
ALTER TABLE `#sql1` RENAME `@0023sql1`;
817
929
ALTER TABLE `@0023sql2` RENAME `#sql2`;
822
932
INSERT INTO `#sql2` VALUES (1);
823
933
INSERT INTO `@0023sql1` VALUES (2);
824
934
SHOW CREATE TABLE `#sql2`;
825
935
Table Create Table
826
936
#sql2 CREATE TEMPORARY TABLE `#sql2` (
827
`c1` int DEFAULT NULL
829
939
SHOW CREATE TABLE `@0023sql1`;
830
940
Table Create Table
831
941
@0023sql1 CREATE TEMPORARY TABLE `@0023sql1` (
832
`c1` int DEFAULT NULL
834
944
DROP TABLE `#sql2`, `@0023sql1`;
835
945
DROP TABLE IF EXISTS t1;
836
946
DROP TABLE IF EXISTS t2;
840
950
INDEX(`int_field`)
843
Field Type Null Default Default_is_NULL On_Update
844
int_field INTEGER FALSE FALSE
845
char_field VARCHAR TRUE TRUE
953
Field Type Null Key Default Extra
954
int_field int NO MUL NULL
955
char_field varchar(10) YES NULL
846
956
SHOW INDEXES FROM t1;
847
Table Unique Key_name Seq_in_index Column_name
848
t1 FALSE int_field 1 int_field
957
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_Comment
958
t1 1 int_field 1 int_field A 0 NULL NULL BTREE
849
959
INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
850
960
"Non-copy data change - new frm, but old data and index files"
851
961
ALTER TABLE t1 CHANGE int_field unsigned_int_field INTEGER NOT NULL, RENAME t2;
862
Field Type Null Default Default_is_NULL On_Update
863
unsigned_int_field INTEGER FALSE FALSE
864
char_field VARCHAR TRUE TRUE
972
Field Type Null Key Default Extra
973
unsigned_int_field int NO MUL NULL
974
char_field varchar(10) YES NULL
866
Field Type Null Default Default_is_NULL On_Update
867
unsigned_int_field INTEGER FALSE FALSE
868
char_field VARCHAR TRUE TRUE
976
Field Type Null Key Default Extra
977
unsigned_int_field int NO MUL NULL
978
char_field varchar(10) YES NULL
869
979
ALTER TABLE t2 MODIFY unsigned_int_field BIGINT NOT NULL;
871
Field Type Null Default Default_is_NULL On_Update
872
unsigned_int_field BIGINT FALSE FALSE
873
char_field VARCHAR TRUE TRUE
981
Field Type Null Key Default Extra
982
unsigned_int_field bigint NO MUL NULL
983
char_field varchar(10) YES NULL
875
985
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
876
986
INSERT INTO t1 VALUES (1, 2, NULL);