Skip to content

Commit

Permalink
sql: fix call of FindIndexWithName
Browse files Browse the repository at this point in the history
In e89093f, we added
`tableDesc.FindIndexWithName(name.String())`. However, `name.String()`
can return a `EncodeRestrictedSQLIdent` version of the string.

This fixes the call to use `string(name)`.

I couldn't produce an error with this at the moment, mostly because
there is some other check preventing it from happening from the
combinations I've tried.

Release note: None
  • Loading branch information
otan committed Jan 18, 2022
1 parent 365b4da commit 93b20e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/alter_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,7 @@ func validateConstraintNameIsNotUsed(
if name == "" {
return false, nil
}
idx, _ := tableDesc.FindIndexWithName(name.String())
idx, _ := tableDesc.FindIndexWithName(string(name))
if idx == nil {
return false, nil
}
Expand Down

0 comments on commit 93b20e7

Please sign in to comment.