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

Function nodeTableName

server/ast/table_name.go:26–51  ·  view source on GitHub ↗

nodeTableName handles *tree.TableName nodes.

(ctx *Context, node *tree.TableName)

Source from the content-addressed store, hash-verified

24
25// nodeTableName handles *tree.TableName nodes.
26func nodeTableName(ctx *Context, node *tree.TableName) (vitess.TableName, error) {
27 if node == nil {
28 return vitess.TableName{}, nil
29 }
30 var dbName, schemaName vitess.TableIdent
31 if node.ExplicitCatalog {
32 dbName = vitess.NewTableIdent(string(node.CatalogName))
33 }
34 if node.ExplicitSchema {
35 schemaName = vitess.NewTableIdent(string(node.SchemaName))
36 }
37 // for the information_schema schema, we treat it as a database name to make queries against it work with the engine
38 // TODO: this is a hack, we need to handle information_schema differently for doltgres, and as a true schema in each db
39 if strings.EqualFold(schemaName.String(), "information_schema") {
40 return vitess.TableName{
41 Name: vitess.NewTableIdent(string(node.ObjectName)),
42 DbQualifier: schemaName,
43 }, nil
44 } else {
45 return vitess.TableName{
46 Name: vitess.NewTableIdent(string(node.ObjectName)),
47 DbQualifier: dbName,
48 SchemaQualifier: schemaName,
49 }, nil
50 }
51}

Callers 15

nodeAlterSequenceFunction · 0.85
nodeCreateSequenceFunction · 0.85
nodeDropViewFunction · 0.85
nodeRenameColumnFunction · 0.85
nodeTableExprFunction · 0.85
nodeCreateTableFunction · 0.85
assignTableDefFunction · 0.85
nodeAlterTableFunction · 0.85
nodeAlterTablePartitionFunction · 0.85
nodeAliasedTableExprFunction · 0.85
nodeDropDomainFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected