Skip to content

Commit

Permalink
Merge pull request #6794 from planetscale/jg_fixdbname
Browse files Browse the repository at this point in the history
Fix dbname that needs escaping that we broke in fce4cfd
  • Loading branch information
deepthi authored Sep 28, 2020
2 parents e0e994d + caa7ffa commit d71611b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions go/vt/mysqlctl/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func encodeTableName(tableName string) string {
return buf.String()
}

// tableListSql returns an IN clause "('t1', 't2'...) for a list of tables."
func tableListSql(tables []string) (string, error) {
// tableListSQL returns an IN clause "('t1', 't2'...) for a list of tables."
func tableListSQL(tables []string) (string, error) {
if len(tables) == 0 {
return "", vterrors.New(vtrpc.Code_INTERNAL, "no tables for tableListSql")
return "", vterrors.New(vtrpc.Code_INTERNAL, "no tables for tableListSQL")
}

encodedTables := make([]string, len(tables))
Expand Down Expand Up @@ -234,7 +234,7 @@ func (mysqld *Mysqld) collectSchema(ctx context.Context, dbName, tableName, tabl
// normalizedSchema returns a table schema with database names replaced, and auto_increment annotations removed.
func (mysqld *Mysqld) normalizedSchema(ctx context.Context, dbName, tableName, tableType string) (string, error) {
backtickDBName := sqlescape.EscapeID(dbName)
qr, fetchErr := mysqld.FetchSuperQuery(ctx, fmt.Sprintf("SHOW CREATE TABLE %s.%s", dbName, sqlescape.EscapeID(tableName)))
qr, fetchErr := mysqld.FetchSuperQuery(ctx, fmt.Sprintf("SHOW CREATE TABLE %s.%s", backtickDBName, sqlescape.EscapeID(tableName)))
if fetchErr != nil {
return "", fetchErr
}
Expand Down Expand Up @@ -308,7 +308,7 @@ func (mysqld *Mysqld) getPrimaryKeyColumns(ctx context.Context, dbName string, t
}
defer conn.Recycle()

tableList, err := tableListSql(tables)
tableList, err := tableListSQL(tables)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit d71611b

Please sign in to comment.