validateCreateTable validates that a table can be created as specified
(ctx *sql.Context, a *analyzer.Analyzer, n sql.Node, scope *plan.Scope, sel analyzer.RuleSelector, qFlags *sql.QueryFlags)
| 26 | |
| 27 | // validateCreateTable validates that a table can be created as specified |
| 28 | func validateCreateTable(ctx *sql.Context, a *analyzer.Analyzer, n sql.Node, scope *plan.Scope, sel analyzer.RuleSelector, qFlags *sql.QueryFlags) (sql.Node, transform.TreeIdentity, error) { |
| 29 | ct, ok := n.(*plan.CreateTable) |
| 30 | if !ok { |
| 31 | return n, transform.SameTree, nil |
| 32 | } |
| 33 | |
| 34 | err := validateIdentifiers(ct) |
| 35 | if err != nil { |
| 36 | return nil, transform.SameTree, err |
| 37 | } |
| 38 | |
| 39 | sch := ct.PkSchema().Schema |
| 40 | idxs := ct.Indexes() |
| 41 | err = validateIndexes(ctx, sch, idxs) |
| 42 | if err != nil { |
| 43 | return nil, transform.SameTree, err |
| 44 | } |
| 45 | |
| 46 | return n, transform.SameTree, nil |
| 47 | } |
| 48 | |
| 49 | // validateIdentifiers validates the names of all schema elements for validity |
| 50 | // TODO: we use 64 character as the max length for an identifier, postgres uses 63 |
nothing calls this directly
no test coverage detected