My favorites | Sign in
Project Home Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 2942: Invalid length for column when changing column datatype
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2012

Sign in to add a comment
Reported by, Aug 27, 2012
What exact steps will reproduce the problem?
1. Create table, add column as DECIMAL(10.2)
2. Save
3. Try to change Datatype to INT
4. Save

What was the expected output?
Length set to default 10 or truncated from 10.2 also to 10

What happened instead?
Length kept as 10.2, error while saving

Same story goes for varchar, binary etc...

Version used?
 HeidiSQL revision: r4181
 MySQL Server version: 5.1.41
 Operating system: win7

Aug 27, 2012
Project Member #1
> What happened instead?
> Length kept as 10.2, error while saving

What error was it, please?
Status: NeedInfo
Aug 28, 2012
SQL Error (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '2) NULL DEFAULT NULL AFTER `Column 3`' at line 2

The SQL produced was  ALTER TABLE `test`
	CHANGE COLUMN `Column 4` `Column 4` INT(10,2) NULL DEFAULT NULL AFTER `Column 3`;
Aug 28, 2012
Project Member #3
Ah ok, you just forgot to modify the length value. If you change the datatype you need to adjust the length of course. That's not a bug in HeidiSQL.
Status: Invalid
Aug 28, 2012
I agree, that's not a bug, it's UI inconsistency.

For example when I change from datatype INT to ENUM, HeidiSQL clearly suggests default set as ('Y','N'), then, when I change it back to INT, it stays this way and generates (rightfully) SQL error. 
Aug 28, 2012
Project Member #5
This issue was closed by revision r4184.
Status: Fixed
Aug 28, 2012
Project Member #6
This is a quite complex problem, as you may notice when you try not to destroy a user entered value in the length/set column. r4184 is a bit more destructive, and applies a default length each time you select a different datatype, until you enter a custom value into length/set. Should fix this inconsistency.
Sign in to add a comment

Powered by Google Project Hosting