Currently, the buildCreateSchema function treats CREATE SCHEMA as a synonym for CREATE DATABASE if no database is selected, following MySQL behavior. This is to support clients like DBeaver which make use of this feature to create databases. dolthub/dolt#9830
For PostgreSQL compatibility, an error should be returned when no database is selected, as PostgreSQL requires a database context for schema creation.
dolthub/go-mysql-server#3217 (comment)_