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

Function nodeIndexTableDef

server/ast/index_table_def.go:28–54  ·  view source on GitHub ↗

nodeIndexTableDef handles *tree.IndexTableDef nodes. The parser does not store type information in the index definition (PRIMARY KEY, UNIQUE, etc.) so it must be added to this definition by the caller.

(ctx *Context, node *tree.IndexTableDef)

Source from the content-addressed store, hash-verified

26// nodeIndexTableDef handles *tree.IndexTableDef nodes. The parser does not store type information in the index
27// definition (PRIMARY KEY, UNIQUE, etc.) so it must be added to this definition by the caller.
28func nodeIndexTableDef(ctx *Context, node *tree.IndexTableDef) (*vitess.IndexDefinition, error) {
29 if node == nil {
30 return nil, nil
31 }
32 if node.IndexParams.IncludeColumns != nil {
33 return nil, errors.Errorf("include columns is not yet supported")
34 }
35 if len(node.IndexParams.StorageParams) > 0 {
36 logrus.Warn("storage params are not yet supported, ignoring")
37 }
38 if node.IndexParams.Tablespace != "" {
39 logrus.Warn("tablespace is not yet supported, ignoring")
40 }
41
42 indexFields, err := nodeIndexElemList(ctx, node.Columns)
43 if err != nil {
44 return nil, err
45 }
46
47 return &vitess.IndexDefinition{
48 Info: &vitess.IndexInfo{
49 Type: "",
50 Name: vitess.NewColIdent(string(node.Name)),
51 },
52 Fields: indexFields,
53 }, nil
54}

Callers 2

assignTableDefFunction · 0.85
nodeCreateIndexFunction · 0.85

Calls 2

nodeIndexElemListFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected