Skip to content

Commit

Permalink
Peform safe escaping of index name
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <[email protected]>
  • Loading branch information
mattlord committed Oct 1, 2023
1 parent dd58b15 commit 08e3617
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"vitess.io/vitess/go/mysql/collations"
"vitess.io/vitess/go/mysql/replication"
"vitess.io/vitess/go/sqlescape"
"vitess.io/vitess/go/sqltypes"
"vitess.io/vitess/go/textutil"
"vitess.io/vitess/go/timer"
Expand Down Expand Up @@ -271,7 +272,8 @@ func (rs *rowStreamer) buildSelect(st *binlogdatapb.MinimalTable) (string, error
// of the PK columns which are used in the ORDER BY clause below.
var indexHint string
if st.PKIndexName != "" {
indexHint = fmt.Sprintf(" force index (`%s`)", st.PKIndexName)
indexHint = fmt.Sprintf(" force index (%s)",
sqlescape.EscapeID(sqlescape.UnescapeID(st.PKIndexName)))
}
buf.Myprintf(" from %v%s", sqlparser.NewIdentifierCS(rs.plan.Table.Name), indexHint)
if len(rs.lastpk) != 0 {
Expand Down

0 comments on commit 08e3617

Please sign in to comment.