Dangerous thing!!

slamarca's profile image slamarca posted 4 years ago in Import/Export Permalink

Hi, today I unrecoverably lost an important table and would like to share my (bad) experience with you. I tried to export a table to an .sql file, didn't know well the software and ended up losing the table; my fault, but maybe the software may be made safer.

I tried to eport the table from the Tools menu, Export as SQL. I selected in the treeview my table, then checked Drop and Create checkboxes, thinking that in the resulting .sql file the software would generate a DROP statement prior to the INSERTs.

I ignored the target Output and Database comboboxes and left the default values thaht the last user had set, ie ouput='Database' and database='information_schema'. I clicked on the Export button and got a error message because I hadn't access privileges for information_schema table. Thinking the name of the db was then culprit, I selected my db and clicke on the Export button again (actually requesting an export from my db to the same db, dropping the tables before creating them). THe software had dropped the table and now I got an error message saying my table coudln't be export because it no lenger existed.

As you can imagine I lost my table. I don't know if it was dropped on the first or second of my tries, but couldn't the software have detected the fact that I was exporting and importing in the same database and prevented me form doing such a stupid thing?

I found no way to recover the lost table and ended up with an enraged customer and many hours of hard work to try to reconstruct the table's data.

Hoping someone could in the future be spared such an unpleasant thing.

ansgar's profile image ansgar posted 4 years ago Permalink

Yes, this is definitely worth to get some safety check in HeidiSQL.

Apart from the existing two things:

  • the "Drop" checkboxes get bold font and exclamation marks when activated
  • the currently selected database is excluded in the "Database" output dropdown list

Description

Perhaps I can extend the second check, so that when you select a different database, or even multiple ones, none of them can be selected as the target database.

ansgar's profile image ansgar posted 4 years ago Permalink

I just created a new ticket with "critical" label - see issue #775

slamarca's profile image slamarca posted 4 years ago Permalink

Well done! Bye

ansgar's profile image ansgar posted 4 years ago Permalink

Issue #775 is now fixed. New build prevents you from selecting a database in the drop-down which is also checked, or partly checked in the tree.

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