-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Description
what does function ParseTableName
mean?
// in file: pkg/sql/parser/parser.go:253
func ParseTableName(sql string) (*tree.UnresolvedObjectName, error) {
// We wrap the name we want to parse into a dummy statement since our parser
// can only parse full statements.
stmt, err := ParseOne(fmt.Sprintf("ALTER TABLE %s RENAME TO x", sql))
if err != nil {
return nil, err
}
rename, ok := stmt.AST.(*tree.RenameTable)
if !ok {
return nil, errors.AssertionFailedf("expected an ALTER TABLE statement, but found %T", stmt)
}
return rename.Name, nil
}
I think this function maybe parser tableName From a sql.
But when put sql
into ALTER TABLE %s RENAME TO x
, It mustn't be parsed ok
Metadata
Metadata
Assignees
Labels
No labels