distal-attribute
distal-attribute
distal-attribute
distal-attribute

Silly typing error create database I cannot remove

Snorvarg posted 3 months ago in General

Hi, I accidentally created a database named "test_db'". Please note the ' character in the name of the database. (My fingers are always all over the keyboard..)

But now I cannot remove the database again! When i right-click on the database i HeidiSql and select Drop database, it says it does not exist.

Nothing serious as you can see, but irritating to have it in the list of databases.

Oh, a bit serious it might be, since I then created a second database named "test_db", and when I tried to delete the old "test_db'" (the one with a ' in the name) HeidiSql instead deleted "test_db" !

kalvaro posted 3 months ago

Nice catch! Apparently, HeidiSQL discards the quote after creating the database:

[Window Title]
~root: Confirm

[Main Instruction]
Drop Database "test_db"?

[Content]
WARNING: You will lose all objects in database test_db!

[OK] [Cancel]

... and then attempts to run:

DROP DATABASE `test_db`;

You are lucky if you didn't have an existing database with that other name...

As a workaround, you can run the correct query yourself, i.e.:

DROP DATABASE `test_db'`;
ansgar posted 3 months ago

Fixed in r5136

ansgar posted 3 months ago

... the fix was not to remove trailing quotes from the database name in a regular expression. So, you should be able to have quotes in a database name as you want or as the server allows that.

Snorvarg posted 3 months ago

Thanks! No, nothing serious happened, I have a local copy of everything on which all work are done.

Please login to leave a reply, or register at first.