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: check schema privileges when dropping role #103467

Merged
merged 1 commit into from
May 17, 2023

Conversation

postamar
Copy link
Contributor

Previously, dropping a role which has privileges on a schema did not result in a error. This patch fixes this bug by adding the missing logic which performs this check.

Fixes #102962.

Release note (bug fix): DROP ROLE now correctly returns an 2BP01 error when the given role has been granted privileges on a schema.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Previously, dropping a role which has privileges on a schema did not
result in a error. This patch fixes this bug by adding the missing
logic which performs this check.

Fixes cockroachdb#102962.

Release note (bug fix): DROP ROLE now correctly returns an 2BP01 error
when the given role has been granted privileges on a schema.
@postamar
Copy link
Contributor Author

Do we also need to add an upgrade step to scan the descriptors system table and garbage-collect any dangling user references in the privilege descriptors, or is that overkill?

@postamar postamar marked this pull request as ready for review May 16, 2023 20:12
@postamar postamar requested a review from a team as a code owner May 16, 2023 20:12
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

i think we can forgo the upgrade step. let's just get to that when we have more of a need. we do have #93940 coming up, which will need to touch all privilege descriptors. i'll leave a note there to look out for dangling references.

thanks for picking this up! i'll add labels to backport this

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@rafiss rafiss added backport-22.2.x backport-23.1.x Flags PRs that need to be backported to 23.1 labels May 16, 2023
@postamar
Copy link
Contributor Author

Makes sense. Thanks for the review!

bors r+

@craig
Copy link
Contributor

craig bot commented May 17, 2023

This PR was included in a batch that timed out, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented May 17, 2023

This PR was included in a batch that timed out, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented May 17, 2023

Build succeeded:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.1.x Flags PRs that need to be backported to 23.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: role with grants on public schema are allowed to be dropped
3 participants