Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vtexplain: properly use sqlparser.String to quote reserved table names #4681

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions go/vt/vtexplain/vtexplain_vttablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ func initTabletEnvironment(ddls []*sqlparser.DDL, opts *Options) error {
}

for i, ddl := range ddls {
table := ddl.Table.Name.String()
table := sqlparser.String(ddl.Table.Name)
schemaQueries[mysql.BaseShowTablesForTable(table)] = &sqltypes.Result{
Fields: mysql.BaseShowTablesFields,
RowsAffected: 1,
Expand Down Expand Up @@ -511,9 +511,10 @@ func (t *explainTablet) HandleQuery(c *mysql.Conn, query string, callback func(*
return callback(&sqltypes.Result{})
}

colTypeMap := tableColumns[table.String()]
if colTypeMap == nil && table.String() != "dual" {
return fmt.Errorf("unable to resolve table name %s", table.String())
tableName := sqlparser.String(table)
colTypeMap := tableColumns[tableName]
if colTypeMap == nil && tableName != "dual" {
return fmt.Errorf("unable to resolve table name %s", tableName)
}

colNames := make([]string, 0, 4)
Expand Down