@@ -1219,6 +1219,75 @@ var AlterTableScripts = []ScriptTest{
12191219 },
12201220 },
12211221 },
1222+
1223+ // Set tests
1224+ {
1225+ Name : "modify set column" ,
1226+ SetUpScript : []string {
1227+ "create table t (i int primary key, s set('a', 'b', 'c'));" ,
1228+ "insert ignore into t values (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7);" ,
1229+ },
1230+ Assertions : []ScriptTestAssertion {
1231+ {
1232+ Query : "select i, s + 0, s from t;" ,
1233+ Expected : []sql.Row {
1234+ {0 , float64 (0 ), "" },
1235+ {1 , float64 (1 ), "a" },
1236+ {2 , float64 (2 ), "b" },
1237+ {3 , float64 (3 ), "a,b" },
1238+ {4 , float64 (4 ), "c" },
1239+ {5 , float64 (5 ), "a,c" },
1240+ {6 , float64 (6 ), "b,c" },
1241+ {7 , float64 (7 ), "a,b,c" },
1242+ },
1243+ },
1244+ {
1245+ Query : "alter table t modify column s set('a', 'b', 'c', 'd');" ,
1246+ Expected : []sql.Row {
1247+ {types .NewOkResult (8 )},
1248+ },
1249+ },
1250+ {
1251+ Query : "select i, s + 0, s from t;" ,
1252+ Expected : []sql.Row {
1253+ {0 , float64 (0 ), "" },
1254+ {1 , float64 (1 ), "a" },
1255+ {2 , float64 (2 ), "b" },
1256+ {3 , float64 (3 ), "a,b" },
1257+ {4 , float64 (4 ), "c" },
1258+ {5 , float64 (5 ), "a,c" },
1259+ {6 , float64 (6 ), "b,c" },
1260+ {7 , float64 (7 ), "a,b,c" },
1261+ },
1262+ },
1263+ {
1264+ Skip : true ,
1265+ Query : "alter table t modify column s set('c', 'b', 'a');" ,
1266+ Expected : []sql.Row {
1267+ {types .NewOkResult (8 )}, // We currently return 0 RowsAffected
1268+ },
1269+ },
1270+ {
1271+ Skip : true ,
1272+ Query : "select i, s + 0, s from t;" ,
1273+ Expected : []sql.Row {
1274+ {0 , 0 , "" },
1275+ {1 , 2 , "a" },
1276+ {2 , 4 , "b" },
1277+ {3 , 6 , "a,b" },
1278+ {4 , 1 , "c" },
1279+ {5 , 3 , "c,a" },
1280+ {6 , 5 , "c,b" },
1281+ {7 , 7 , "c,a,b" },
1282+ },
1283+ },
1284+ {
1285+ Skip : true ,
1286+ Query : "alter table t modify column s set('a');" ,
1287+ ExpectedErrStr : "Data truncated for column" , // We currently throw value 2 is not valid for this set
1288+ },
1289+ },
1290+ },
12221291}
12231292
12241293var RenameTableScripts = []ScriptTest {
0 commit comments