"Empty table"-command with foreign key

[expired user #5151]'s profile image [expired user #5151] posted 10 years ago in General Permalink
Hi,
I have two MySQL tables. Table A points to table B via foreign key. If I use "empty table" in HeidiSQL on table B, a TRUNCATE TABLE statement is executed. This statement then fails if FOREIGN_KEY_CHECK ist enabled.

My suggestion: check if a foreign key points to the table (info available in information_schema) and use the slower DELETE TABLE statement instead.
Otherwise a second menu-option (perhaps in a submenu like the one at "create new") to choose between TRUNCATE and DELETE would be nice.

Greetings
Plasm
[expired user #4822]'s profile image [expired user #4822] posted 9 years ago Permalink
+1 to this suggestion.
matsg's profile image matsg posted 7 years ago Permalink

Another +1 from me... I use foreign keys a lot.

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