MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / ParseFunctionName

Function ParseFunctionName

pkg/sql/parser/parse.go:311–323  ·  view source on GitHub ↗

ParseFunctionName parses a function name. The function name must contain one or more name parts, using the full input SQL syntax: each name part containing special characters, or non-lowercase characters, must be enclosed in double quote. The name may not be an invalid function name (the caller is r

(sql string)

Source from the content-addressed store, hash-verified

309// function name (the caller is responsible for guaranteeing that only
310// valid function names are provided as input).
311func ParseFunctionName(sql string) (*tree.UnresolvedObjectName, error) {
312 // We wrap the name we want to parse into a dummy statement since our parser
313 // can only parse full statements.
314 stmt, err := ParseOne(fmt.Sprintf("ALTER FUNCTION %s RENAME TO x", sql))
315 if err != nil {
316 return nil, err
317 }
318 rename, ok := stmt.AST.(*tree.AlterRoutineRename)
319 if !ok {
320 return nil, errors.AssertionFailedf("expected an ALTER FUNCTION statement, but found %T", stmt)
321 }
322 return rename.Function.FuncName.ToUnresolvedObjectName(), nil
323}
324
325// ParseTablePattern parses a table pattern. The table name must contain one
326// or more name parts, using the full input SQL syntax: each name

Callers

nothing calls this directly

Calls 2

ParseOneFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…