From 93b20e7931ae27b10dc5e8bf95405bc972fed5da Mon Sep 17 00:00:00 2001 From: Oliver Tan Date: Wed, 19 Jan 2022 10:35:59 +1100 Subject: [PATCH] sql: fix call of `FindIndexWithName` In e89093faf7225a635ddb5d4f260b20a4d8dd64e2, 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 --- pkg/sql/alter_table.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sql/alter_table.go b/pkg/sql/alter_table.go index 02034c8d1acc..07bd58ea400d 100644 --- a/pkg/sql/alter_table.go +++ b/pkg/sql/alter_table.go @@ -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 }