Menu

#1197 Table editor breaks default value NULL

NeedInfo
nobody
None
Problematic
Defect
2009-06-09
2009-06-07
Anonymous
No

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

Discussion

  • Anonymous

    Anonymous - 2009-06-08

    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

     
  • Anonymous

    Anonymous - 2009-06-09

    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