Skip to content

Commit d4e4eb0

Browse files
authored
Merge branch 'angela/create_table' into angelamayxie-5a45c06a
2 parents 7020fe5 + f03559a commit d4e4eb0

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

enginetest/queries/create_table_queries.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

9901012
var CreateTableInSubroutineTests = []ScriptTest{

enginetest/queries/script_queries.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4693,7 +4693,7 @@ CREATE TABLE tab3 (
46934693
{
46944694
Query: "select COLUMN_NAME, DATA_TYPE from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='c';",
46954695
Expected: []sql.Row{
4696-
{"coalesce(NULL,1)", "int"},
4696+
{"coalesce(NULL, 1)", "int"},
46974697
},
46984698
},
46994699
},

0 commit comments

Comments
 (0)