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)
| 309 | // function name (the caller is responsible for guaranteeing that only |
| 310 | // valid function names are provided as input). |
| 311 | func 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…