My favorites | Sign in
Project Home Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2702: Reload CREATE TABLE after saving table structure
2 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  ----


Sign in to add a comment
 
Reported by barthazar, Jan 28, 2012
What exact steps will reproduce the problem?

1. create a table with a single-column primary key
2. remove the column the primary key is based on, WITHOUT removing the key first

OR

1. create a table with a compound key
2. remove one of the columns the compound key is based on

What was the expected output?
The information in 'Table'->'Indexes' and 'Table'->'CREATE code' tabs should immediately account for the removed columns: keys based on one column should be removed when that column is removed, description of compound keys should be updated so the removed columns is no longer listed as a member or removed entirely if all members have been removed;

What happened instead?
1. 'Table'->'Indexes' and 'Table'->'CREATE code' tabs kept showing the primary key
2. 'Table'->'Indexes' and 'Table'->'CREATE code' tabs kept listing the removed members of the compound key

Furthermore, the information is not updated on "Save" - user has to switch to a different table and return to the original one for the information to be corrected.

Dangers:
Without reloading table information, it's possible to build invalid ALTER statements through the GUI, for example:

ALTER TABLE `some_table`
	DROP COLUMN `ID`; -- the PRIMARY KEY is based on this one

ALTER TABLE `some_table`
	DROP PRIMARY KEY; -- produces an error, that key no longer exists


Version used?
 HeidiSQL revision: 6.0.0.4034
 MySQL Server version: 5.1.53 (local), 5.0.51 (Debian, SSH)
 Operating system: Windows 7 Professional N SP1

Jan 28, 2012
Project Member #1 a...@anse.de
Confirmed, I saw this problem too. The fix will be not to do all the same silent stuff the server does (removing the key), but to reload the CREATE TABLE code from the server after saving. This was, the dangerous parts are fixed. However, I see this more an enhancement but a bug. Anyway.
Summary: Reload CREATE TABLE after saving table structure
Status: Accepted
Labels: -Type-Defect Type-Enhancement Severity-Default
Apr 15, 2012
Project Member #2 a...@anse.de
 Issue 2824  has been merged into this issue.
Sign in to add a comment

Powered by Google Project Hosting