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 UX for dropping a user with default privileges #76950

Closed
RichardJCai opened this issue Feb 23, 2022 · 3 comments
Closed

sql: Fix UX for dropping a user with default privileges #76950

RichardJCai opened this issue Feb 23, 2022 · 3 comments
Assignees
Labels
A-sql-privileges SQL privilege handling and permission checks. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)

Comments

@RichardJCai
Copy link
Contributor

Example in 21.2

CREATE USER foo;
GRANT SELECT ON DATABASE defaultdb TO foo;
REVOKE ALL ON DATABASE defaultdb FROM foo;
DROP USER foo;

Results in error

Query 1 ERROR: ERROR: role foo cannot be dropped because some objects depend on it
privileges for default privileges on new relations for all roles
HINT: use SHOW DEFAULT PRIVILEGES FOR ROLE to find existing default privileges and execute ALTER DEFAULT PRIVILEGES {FOR ROLE ... / FOR ALL ROLES} REVOKE ... ON ... FROM ... to remove them
see: SHOW DEFAULT PRIVILEGES and ALTER DEFAULT PRIVILEGES

We should make it clear how to revoke that privilege, for example it is not clear which database it is even on.

@RichardJCai RichardJCai added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Feb 23, 2022
@RichardJCai RichardJCai self-assigned this Feb 23, 2022
@RichardJCai RichardJCai added A-sql-privileges SQL privilege handling and permission checks. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions) labels Feb 23, 2022
@rafiss
Copy link
Collaborator

rafiss commented Feb 28, 2022

fixed by #77016

@rafiss rafiss closed this as completed Feb 28, 2022
@georgeli-roblox
Copy link

it would be good to have a feature drop user <username> cascade so it will take care of all the clean-ups it needs on the DB side ? Thanks

@RichardJCai
Copy link
Contributor Author

it would be good to have a feature drop user <username> cascade so it will take care of all the clean-ups it needs on the DB side ? Thanks

We plan on adding support for drop owned by (postgres has this instead of cascade)
#55381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-privileges SQL privilege handling and permission checks. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-foundations SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Projects
None yet
Development

No branches or pull requests

3 participants