@@ -1029,12 +1029,58 @@ var AlterTableScripts = []ScriptTest{
10291029 },
10301030 },
10311031 },
1032+ {
1033+ Name : "alter table comment" ,
1034+ SetUpScript : []string {
1035+ "create table t (i int)" ,
1036+ "create table tableWithComment (i int) comment = 'comment'" ,
1037+ },
1038+ Assertions : []ScriptTestAssertion {
1039+ {
1040+ Query : "show create table t" ,
1041+ Expected : []sql.Row {{
1042+ "t" ,
1043+ "CREATE TABLE `t` (\n `i` int\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" ,
1044+ }},
1045+ },
1046+ {
1047+ Query : "show create table tableWithComment" ,
1048+ Expected : []sql.Row {{
1049+ "tableWithComment" ,
1050+ "CREATE TABLE `tableWithComment` (\n `i` int\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT='comment'" ,
1051+ }},
1052+ },
1053+ {
1054+ Query : "alter table t comment = 'new comment'" ,
1055+ Expected : []sql.Row {{types .NewOkResult (0 )}},
1056+ },
1057+ {
1058+ Query : "alter table tableWithComment comment = 'new comment'" ,
1059+ Expected : []sql.Row {{types .NewOkResult (0 )}},
1060+ },
1061+ {
1062+ Query : "show create table t" ,
1063+ Expected : []sql.Row {{
1064+ "t" ,
1065+ "CREATE TABLE `t` (\n `i` int\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT='new comment'" ,
1066+ }},
1067+ },
1068+ {
1069+ Query : "show create table tableWithComment" ,
1070+ Expected : []sql.Row {{
1071+ "tableWithComment" ,
1072+ "CREATE TABLE `tableWithComment` (\n `i` int\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT='new comment'" ,
1073+ }},
1074+ },
1075+ },
1076+ },
10321077 {
10331078 Name : "alter table comments are escaped" ,
10341079 SetUpScript : []string {
10351080 "create table t (i int);" ,
10361081 `alter table t modify column i int comment "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A"` ,
10371082 `alter table t add column j int comment "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A"` ,
1083+ `alter table t comment = "newline \n | return \r | backslash \\ | NUL \0 \x00 | ctrlz \Z \x1A"` ,
10381084 },
10391085 Assertions : []ScriptTestAssertion {
10401086 {
@@ -1043,7 +1089,7 @@ var AlterTableScripts = []ScriptTest{
10431089 "t" ,
10441090 "CREATE TABLE `t` (\n `i` int COMMENT 'newline \\ n | return \\ r | backslash \\ \\ | NUL \\ 0 x00 | ctrlz \x1A x1A'," +
10451091 "\n `j` int COMMENT 'newline \\ n | return \\ r | backslash \\ \\ | NUL \\ 0 x00 | ctrlz \x1A x1A'\n " +
1046- ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" }},
1092+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin COMMENT='newline \\ n | return \\ r | backslash \\ \\ | NUL \\ 0 x00 | ctrlz \u001A x1A' " }},
10471093 },
10481094 },
10491095 },
0 commit comments