@@ -837,7 +837,7 @@ var CreateTableScriptTests = []ScriptTest{
837837 Query : "show create table t4;" ,
838838 Expected : []sql.Row {
839839 {"t4" , "CREATE TABLE `t4` (\n " +
840- " `(a. j + 1) ` bigint\n " +
840+ " `j + 1` bigint\n " +
841841 ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
842842 },
843843 },
@@ -985,6 +985,28 @@ var CreateTableScriptTests = []ScriptTest{
985985 },
986986 },
987987 },
988+ {
989+ Name : "create table columns from aggregate functions" ,
990+ SetUpScript : []string {
991+ "create table t1 (i int)" ,
992+ "insert into t1 values (1)" ,
993+ "create table t2 select sum(i), max(i), min(i), avg(i) from t1" ,
994+ },
995+ Assertions : []ScriptTestAssertion {
996+ {
997+ Query : "show create table t2;" ,
998+ // TODO: MySQL column types are different https://github.com/dolthub/dolt/issues/9754
999+ Expected : []sql.Row {
1000+ {"t2" , "CREATE TABLE `t2` (\n " +
1001+ " `sum(i)` double NOT NULL,\n " +
1002+ " `max(i)` int NOT NULL,\n " +
1003+ " `min(i)` int NOT NULL,\n " +
1004+ " `avg(i)` double\n " +
1005+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin" },
1006+ },
1007+ },
1008+ },
1009+ },
9881010}
9891011
9901012var CreateTableInSubroutineTests = []ScriptTest {
0 commit comments