Skip to content

Commit cbafdb0

Browse files
committed
add TODO and mv test
1 parent 6ee4480 commit cbafdb0

File tree

2 files changed

+47
-46
lines changed

2 files changed

+47
-46
lines changed

enginetest/queries/script_queries.go

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -121,52 +121,6 @@ type ScriptTestAssertion struct {
121121
// Unlike other engine tests, ScriptTests must be self-contained. No other tables are created outside the definition of
122122
// the tests.
123123
var ScriptTests = []ScriptTest{
124-
{
125-
// https://github.com/dolthub/dolt/pull/9830
126-
Name: "CREATE SCHEMA without database selection falls back to CREATE DATABASE",
127-
SetUpScript: []string{
128-
"CREATE DATABASE tmp",
129-
"USE tmp",
130-
},
131-
Dialect: "mysql",
132-
Assertions: []ScriptTestAssertion{
133-
{
134-
Query: "DROP DATABASE tmp",
135-
},
136-
{
137-
Query: "CREATE SCHEMA NewDatabase",
138-
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
139-
},
140-
{
141-
Query: "SHOW DATABASES",
142-
Expected: []sql.Row{{"NewDatabase"}, {"information_schema"}, {"mydb"}, {"mysql"}},
143-
},
144-
{
145-
Query: "USE NewDatabase",
146-
Expected: []sql.Row{},
147-
},
148-
{
149-
Query: "SELECT DATABASE()",
150-
Expected: []sql.Row{{"NewDatabase"}},
151-
},
152-
{
153-
Query: "CREATE TABLE test_table (id INT PRIMARY KEY)",
154-
Expected: []sql.Row{{types.OkResult{RowsAffected: 0}}},
155-
},
156-
{
157-
Query: "SHOW TABLES",
158-
Expected: []sql.Row{{"test_table"}},
159-
},
160-
{
161-
Query: "USE mydb",
162-
Expected: []sql.Row{},
163-
},
164-
{
165-
Query: "DROP DATABASE NewDatabase",
166-
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
167-
},
168-
},
169-
},
170124
{
171125
// https://github.com/dolthub/go-mysql-server/issues/3216
172126
Name: "UNION ALL with BLOB columns",
@@ -13565,6 +13519,52 @@ var BrokenScriptTests = []ScriptTest{
1356513519
}
1356613520

1356713521
var CreateDatabaseScripts = []ScriptTest{
13522+
{
13523+
// https://github.com/dolthub/dolt/pull/9830
13524+
Name: "CREATE SCHEMA without database selection falls back to CREATE DATABASE",
13525+
SetUpScript: []string{
13526+
"CREATE DATABASE tmp",
13527+
"USE tmp",
13528+
},
13529+
Dialect: "mysql",
13530+
Assertions: []ScriptTestAssertion{
13531+
{
13532+
Query: "DROP DATABASE tmp",
13533+
},
13534+
{
13535+
Query: "CREATE SCHEMA NewDatabase",
13536+
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
13537+
},
13538+
{
13539+
Query: "SHOW DATABASES",
13540+
Expected: []sql.Row{{"NewDatabase"}, {"information_schema"}, {"mydb"}, {"mysql"}},
13541+
},
13542+
{
13543+
Query: "USE NewDatabase",
13544+
Expected: []sql.Row{},
13545+
},
13546+
{
13547+
Query: "SELECT DATABASE()",
13548+
Expected: []sql.Row{{"NewDatabase"}},
13549+
},
13550+
{
13551+
Query: "CREATE TABLE test_table (id INT PRIMARY KEY)",
13552+
Expected: []sql.Row{{types.OkResult{RowsAffected: 0}}},
13553+
},
13554+
{
13555+
Query: "SHOW TABLES",
13556+
Expected: []sql.Row{{"test_table"}},
13557+
},
13558+
{
13559+
Query: "USE mydb",
13560+
Expected: []sql.Row{},
13561+
},
13562+
{
13563+
Query: "DROP DATABASE NewDatabase",
13564+
Expected: []sql.Row{{types.OkResult{RowsAffected: 1}}},
13565+
},
13566+
},
13567+
},
1356813568
{
1356913569
Name: "CREATE DATABASE and create table",
1357013570
Assertions: []ScriptTestAssertion{

sql/rowexec/ddl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,7 @@ func (b *BaseBuilder) buildCreateSchema(ctx *sql.Context, n *plan.CreateSchema,
409409
// If no database is selected, first try to fall back to CREATE DATABASE
410410
// since CREATE SCHEMA is a synonym for CREATE DATABASE in MySQL
411411
// https://dev.mysql.com/doc/refman/8.4/en/create-database.html
412+
// TODO: For PostgreSQL, return an error if no database is selected.
412413
if database == "" {
413414
return b.buildCreateDB(ctx, &plan.CreateDB{
414415
Catalog: n.Catalog,

0 commit comments

Comments
 (0)