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

sql: fix call of FindIndexWithName #75115

Merged
merged 1 commit into from
Jan 20, 2022
Merged

Conversation

otan
Copy link
Contributor

@otan otan commented Jan 18, 2022

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

@otan otan requested review from postamar and a team January 18, 2022 23:35
@cockroach-teamcity
Copy link
Member

This change is Reviewable

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
Copy link
Contributor

@postamar postamar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder how many other instances of this bug are out there. Is it worth making a linter check to prevent this? It's an easy mistake to make.

@otan
Copy link
Contributor Author

otan commented Jan 20, 2022

haha, yeah it's easy to make. linter? yes but i'm not 100% on the conditions to make it trigger...

bors r=postamar

@craig
Copy link
Contributor

craig bot commented Jan 20, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 20, 2022

Build succeeded:

@craig craig bot merged commit ebda0ec into cockroachdb:master Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants