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

Add IF EXISTS to DROP ROLE #21985

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dekimir
Copy link
Contributor

@dekimir dekimir commented May 15, 2024

Description

Add optional IF EXISTS to DROP ROLE, which suppresses the role-not-found error that you'd otherwise get.

Additional context and related issues

Although this option isn't in the ANSI SQL, it's a UX improvement that Trino has traditionally admitted.

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:

# Section
* Extend `DROP ROLE` to allow `IF EXISTS`.

... in preparation for TestDropRoleTask.
@cla-bot cla-bot bot added the cla-signed label May 15, 2024
@dekimir dekimir requested a review from mosabua May 15, 2024 20:55
@github-actions github-actions bot added the docs label May 15, 2024
@dekimir dekimir requested a review from martint May 15, 2024 20:55
*/
@TestInstance(PER_CLASS)
@Execution(CONCURRENT)
public class BaseRoleTaskTest
Copy link
Member

Choose a reason for hiding this comment

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

Don't use inheritance for this. It makes it harder to maintain the tests, as the subclasses are intimately coupled to the details of the parent. Over time, as some of the tests evolve, the parent becomes a kitchen sink of functionality.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What would be a good way to factor out the boilerplate and make new tests easy to add? I thought about putting the DropRole tests and SetRole tests into the same class, but I like the regularity of Test<class name>Task naming.

I could, of course, copy-paste the boilerplate into TestDropRoleTask, but that felt unsatisfying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants