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

Function nodeDropType

server/ast/drop_type.go:27–44  ·  view source on GitHub ↗

nodeDropType handles *tree.DropType nodes.

(ctx *Context, node *tree.DropType)

Source from the content-addressed store, hash-verified

25
26// nodeDropType handles *tree.DropType nodes.
27func nodeDropType(ctx *Context, node *tree.DropType) (vitess.Statement, error) {
28 if node == nil {
29 return nil, nil
30 }
31 if len(node.Names) != 1 {
32 return nil, errors.Errorf("dropping multiple types in DROP TYPE is not yet supported")
33 }
34 tn := node.Names[0].ToTableName()
35 return vitess.InjectedStatement{
36 Statement: pgnodes.NewDropType(
37 node.IfExists,
38 tn.Catalog(),
39 tn.Schema(),
40 tn.Object(),
41 node.DropBehavior == tree.DropCascade),
42 Children: nil,
43 }, nil
44}

Callers 1

ConvertFunction · 0.85

Calls 5

ToTableNameMethod · 0.80
ErrorfMethod · 0.65
CatalogMethod · 0.65
SchemaMethod · 0.65
ObjectMethod · 0.65

Tested by

no test coverage detected