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

Disallow converting database to schema for the current database #53563

Closed
vy-ton opened this issue Aug 27, 2020 · 1 comment · Fixed by #53564
Closed

Disallow converting database to schema for the current database #53563

vy-ton opened this issue Aug 27, 2020 · 1 comment · Fixed by #53564

Comments

@vy-ton
Copy link
Contributor

vy-ton commented Aug 27, 2020

If a user uses ALTER DATABASE... CONVERT TO SCHEMA WITH PARENT... for the database they are currently connected to, CockroachDB allows it which causes a bad UX after the database is deleted

root@127.0.0.1:63916/rafi> ALTER DATABASE rafi CONVERT TO SCHEMA WITH PARENT my_app;
TODO (rohany): Implement

Time: 124.378ms

warning: error retrieving the database name: pq: database "rafi" does not exist

root@127.0.0.1:63916/?> show databases;
  database_name
-----------------
  bill
  defaultdb
  movr
  my_app
  postgres
  system
  vy
(7 rows)

Time: 2.71ms

warning: error retrieving the database name: pq: database "adam" does not exist
root@127.0.0.1:63916/?> show search_path;
ERROR: database "adam" does not exist
SQLSTATE: 3D000
warning: error retrieving the database name: pq: database "adam" does not exist

Desired behavior
Instead, we should disallow this command for the current database and error out

@vy-ton vy-ton added this to Triage in SQL Foundations via automation Aug 27, 2020
@blathers-crl
Copy link

blathers-crl bot commented Aug 27, 2020

Hi @vy-ton, please add a C-ategory label to your issue. Check out the label system docs.

While you're here, please consider adding an A- label to help keep our repository tidy.

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant