MCPcopy Create free account
hub / github.com/dolthub/doltgresql / validateCreateTable

Function validateCreateTable

server/analyzer/validate_create_table.go:28–47  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

26
27// validateCreateTable validates that a table can be created as specified
28func 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

Callers

nothing calls this directly

Calls 4

validateIdentifiersFunction · 0.85
validateIndexesFunction · 0.85
PkSchemaMethod · 0.65
IndexesMethod · 0.65

Tested by

no test coverage detected