-
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: dropping user with default privilege's error message is more clear #77016
sql: dropping user with default privilege's error message is more clear #77016
Conversation
pkg/sql/drop_role.go
Outdated
) | ||
} else { | ||
err = errors.Newf( | ||
"privileges for default privileges on new %s belonging to role %s", | ||
objectType, role.Role, | ||
wrapErrorMsgWithSchemaName("privileges for default privileges on new %s belonging to role %s in database %s"), |
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.
any reason not to use errors.WithDetail
here? should we add a errors.WithHint
to suggest what syntax can be used to remove the default privileges?
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.
We can add a hint for each but I'm slightly afraid it might make it too verbose, but I think we'd rather err that way than making it more obfuscated so I'm for it.
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.
Yeah alright but I'd say the table info should be a detail
dbade07
to
586f44c
Compare
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.
lgtm! is the 21.1 backport actually needed? there's no default privs there right?
Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @otan, @RichardJCai, and @ZhouXing19)
Release note (sql change): When dropping a user that has default privileges, the error message now includes which database and schema the default privileges are defined in. Additionally a hint is given to show exactly how to remove the default privileges. Example: pq: role testuser4 cannot be dropped because some objects depend on it owner of default privileges on new sequences belonging to role testuser4 in database testdb2 in schema s privileges for default privileges on new sequences belonging to role testuser3 in database testdb2 in schema s privileges for default privileges on new sequences for all roles in database testdb2 in schema public privileges for default privileges on new sequences for all roles in database testdb2 in schema s HINT: USE testdb2; ALTER DEFAULT PRIVILEGES FOR ROLE testuser4 IN SCHEMA S REVOKE ALL ON SEQUENCES FROM testuser3; USE testdb2; ALTER DEFAULT PRIVILEGES FOR ROLE testuser3 IN SCHEMA S REVOKE ALL ON SEQUENCES FROM testuser4; USE testdb2; ALTER DEFAULT PRIVILEGES FOR ALL ROLES IN SCHEMA PUBLIC REVOKE ALL ON SEQUENCES FROM testuser4; USE testdb2; ALTER DEFAULT PRIVILEGES FOR ALL ROLES IN SCHEMA S REVOKE ALL ON SEQUENCES FROM testuser4;
586f44c
to
93337c8
Compare
Yeah don't need 21.1 |
TFTR! bors r=rafiss |
Build succeeded: |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from 93337c8 to blathers/backport-release-21.2-77016: POST https://api.github.com/repos/cockroachlabs/cockroach/merges: 403 Resource not accessible by integration [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 21.2.x failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Release note (sql change): When dropping a user that has default privileges,
the error message now includes which database and schema the default privileges
are defined in.
Error message now includes the database name and schema name for which the default privileges are defined.
The UX is still not ideal here but this is a good first step.
Example: