(stmt *ast.CreateSchemaStmt)
| 96 | } |
| 97 | |
| 98 | func (c *Catalog) createSchema(stmt *ast.CreateSchemaStmt) error { |
| 99 | if stmt.Name == nil { |
| 100 | return fmt.Errorf("create schema: empty name") |
| 101 | } |
| 102 | if _, err := c.getSchema(*stmt.Name); err == nil { |
| 103 | // If the default schema already exists, treat additional CREATE SCHEMA |
| 104 | // statements as no-ops. |
| 105 | if *stmt.Name == c.DefaultSchema { |
| 106 | return nil |
| 107 | } |
| 108 | if !stmt.IfNotExists { |
| 109 | return sqlerr.SchemaExists(*stmt.Name) |
| 110 | } |
| 111 | } |
| 112 | c.Schemas = append(c.Schemas, &Schema{Name: *stmt.Name}) |
| 113 | return nil |
| 114 | } |
| 115 | |
| 116 | func (c *Catalog) dropSchema(stmt *ast.DropSchemaStmt) error { |
| 117 | // TODO: n^2 in the worst-case |
no test coverage detected