-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: avoid role existence check in DROP ROLE when it's not necessary #134979
Conversation
We only need to make the RoleExists call when the `IF EXISTS` clause is used. This check was recently added in 696869a. Release note: None
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I missed this in my review.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @Dedej-Bergin)
Maybe we can combine these here?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @rafiss)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 2 of 0 LGTMs obtained (waiting on @Dedej-Bergin)
pkg/sql/drop_role.go
line 113 at r1 (raw file):
Previously, Dedej-Bergin (Bergin Dedej) wrote…
Maybe we can combine these here?
if roleExists, err := RoleExists(params.ctx, params.p.InternalSQLTxn(), name); err != nil { return err } else if !roleExists { // If the role does not exist, we can skip the check for targetIsAdmin. continue }
that is possible, but it does make the if statement a bit longer and hard to read. it also only saves 2 lines of code, so i don't feel that it's needed
Previously, rafiss (Rafi Shamim) wrote…
What about this to reduce nesting?
|
tftr bors r+ |
We only need to make the RoleExists call when the
IF EXISTS
clause is used.This check was recently added in 696869a.
informs: #134538
Release note: None