From 3b142af2c7ddafeefbe842fc3e17ab40574de7e1 Mon Sep 17 00:00:00 2001 From: Adrian Walker Date: Fri, 7 Apr 2023 12:44:45 -0500 Subject: [PATCH] CLOUD-1456: SERVERLESS - CREATE DATABASE (#2375) statement without a units qualifier causes it to be set to 0 Co-authored-by: Adrian Walker --- sql3/planner/compilecreatedatabase.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql3/planner/compilecreatedatabase.go b/sql3/planner/compilecreatedatabase.go index a235e174d..48c53c6a0 100644 --- a/sql3/planner/compilecreatedatabase.go +++ b/sql3/planner/compilecreatedatabase.go @@ -17,7 +17,10 @@ func (p *ExecutionPlanner) compileCreateDatabaseStatement(stmt *parser.CreateDat databaseName := strings.ToLower(parser.IdentName(stmt.Name)) failIfExists := !stmt.IfNotExists.IsValid() - units := 0 + // By default, a database needs at least 1 unit for simple querying, so by + // setting the default to 1, users can simply type `CREATE DATABASE [name]` without + // needing to append `WITH UNITS 1;` + units := 1 description := "" // apply database options