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

Checking if database is used currently when dropping database #4029

Closed
killme2008 opened this issue May 24, 2024 · 1 comment
Closed

Checking if database is used currently when dropping database #4029

killme2008 opened this issue May 24, 2024 · 1 comment
Assignees
Labels
C-enhancement Category Enhancements good first issue Good for newcomers

Comments

@killme2008
Copy link
Contributor

What type of enhancement is this?

User experience

What does the enhancement do?

The GreptimeDB doesn't checking if current session is using the database which will be dropped:

mysql> create database test;
Query OK, 1 row affected (0.05 sec)

mysql> use test;
Database changed

mysql> drop database test;
Query OK, 0 rows affected (0.02 sec)

It's better to prevent dropping the database if the user is using it in MySQL or Postgres Session.

Implementation challenges

Looks like it can be checked at

pub async fn drop_database(

Retrieving the current database using QueryContext#current_schema and checking if it's the database to be dropped.

@killme2008 killme2008 added C-enhancement Category Enhancements good first issue Good for newcomers labels May 24, 2024
@killme2008 killme2008 changed the title Checking current database when dropping database Checking if database is using currently when dropping database May 24, 2024
@killme2008 killme2008 changed the title Checking if database is using currently when dropping database Checking if database is used currently when dropping database May 24, 2024
@etolbakov
Copy link
Collaborator

I might give it a shot if that’s ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category Enhancements good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants