1--disable_warnings
2drop table if exists t1;
3--enable_warnings
4
5SET @OLD_SQL_MODE=@@SQL_MODE;
6SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
7
8create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1='1v1';
9show create table t1;
10drop table t1;
11
12--echo #reassiginig options in the same line
13create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1 TKEY1=DEFAULT tkey1=1v2 tkey2=2v1;
14show create table t1;
15
16-- echo #add option
17alter table t1 tkey4=4v1;
18show create table t1;
19
20--echo #remove options
21alter table t1 tkey3=DEFAULT tkey4=DEFAULT;
22show create table t1;
23
24drop table t1;
25
26create table t1 (a int fkey1=v1, key akey (a) kkey1=v1) tkey1=1v1 tkey1=1v2 TKEY1=DEFAULT tkey2=2v1 tkey3=3v1;
27show create table t1;
28
29--echo #change field with option with the same value
30alter table t1 change a a int `FKEY1`='v1';
31show create table t1;
32--echo #change field with option with a different value
33alter table t1 change a a int fkey1=v2;
34show create table t1;
35--echo #new column no options
36alter table t1 add column b int;
37show create table t1;
38--echo #new key with options
39alter table t1 add key bkey (b) kkey2=v1;
40show create table t1;
41--echo #new column with options
42alter table t1 add column c int fkey1=v1 fkey2=v2;
43show create table t1;
44--echo #new key no options
45alter table t1 add key ckey (c);
46show create table t1;
47--echo #drop column
48alter table t1 drop b;
49show create table t1;
50--echo #add column with options after delete
51alter table t1 add column b int fkey2=v1;
52show create table t1;
53--echo #add key
54alter table t1 add key bkey (b) kkey2=v2;
55show create table t1;
56drop table t1;
57
58#numeric (unquoted) value
59create table t1 (a int) tkey1=100;
60show create table t1;
61drop table t1;
62
63--echo #error on unknown option
64SET SQL_MODE='';
65--error ER_UNKNOWN_OPTION
66create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1;
67
68SET @@SQL_MODE=@OLD_SQL_MODE;
69