Table editor breaks default value NULL
Brought to you by:
ansgarbecker
Originally created by: akam...@gmail.com
When altering/creating table "DEFAULT" statement is always added
so if the NOT NULL is used we have "NOT NULL DEFAULT NULL" in code
and thus the error appears that the default value is invalid.
HeidiSQL revision: 2466
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Tickets"
Originally posted by: a...@anse.de
> When altering/creating table "DEFAULT" statement is always added
Yes, and that's otherwise done silently by the server. But it should never break any
existing default value in the manner you describe. A new column has by default "NULL
DEFAULT NULL" and altering a column reads out the existing column definition.
So I cannot reproduce this here. Please post the CREATE TABLE statement for a table
where this happens.
Summary: Table editor breaks default value NULL
Labels: Severity-Problematic
Status: NeedInfo
View and moderate all "tickets Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Tickets"
Originally posted by: akam...@gmail.com
so, i create a table.
uncheck "Allow NULL", press "Save" and then recieve:
invalid default value for 'name'
the code is:
CREATE TABLE `ids` (
`id` INT(10) NULL DEFAULT NULL,
`name` VARCHAR(10) NOT NULL DEFAULT NULL
)
COMMENT = ''
COLLATE = utf8_general_ci
ENGINE = MyISAM
ROW_FORMAT = DEFAULT
CHECKSUM = 0
-------------------------
the problem is in "NOT NULL DEFAULT NULL"
i think when i uncheck "allow null" it's better not to use DEFAULT NULL at all.
the possible workaround option is --- DEFAULT ''--- but the matter is that i dont
need DEFAULT at all. it should be possible not to use it