0

After fixing Error 1253 (MySQL: Unable to fulling forward engineering Sakila (sample) into server), I have Error 1628.

Executing SQL script in server

ERROR: Error 1628: Comment for table 'customer' is too long (max = 60)

Scripts:

CREATE  TABLE IF NOT EXISTS `sakila`.`customer` (

  `customer_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT ,

  `store_id` TINYINT(3) UNSIGNED NOT NULL ,

  `first_name` VARCHAR(45) NOT NULL ,

  `last_name` VARCHAR(45) NOT NULL ,

  `email` VARCHAR(50) NULL DEFAULT NULL ,

  `address_id` SMALLINT(5) UNSIGNED NOT NULL ,

  `active` TINYINT(1) NOT NULL DEFAULT TRUE ,

  `create_date` DATETIME NOT NULL ,

  `last_update` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ,

  PRIMARY KEY (`customer_id`) ,

  INDEX `idx_fk_store_id` (`store_id` ASC) ,

  INDEX `idx_fk_address_id` (`address_id` ASC) ,

  INDEX `idx_last_name` (`last_name` ASC) ,

  CONSTRAINT `fk_customer_address`

    FOREIGN KEY (`address_id` )

    REFERENCES `sakila`.`address` (`address_id` )

    ON DELETE RESTRICT

    ON UPDATE CASCADE,

  CONSTRAINT `fk_customer_store`

    FOREIGN KEY (`store_id` )

    REFERENCES `sakila`.`store` (`store_id` )

    ON DELETE RESTRICT

    ON UPDATE CASCADE)

ENGINE = InnoDB

DEFAULT CHARACTER SET = utf8

COMMENT 'Table storing all customers. Holds foreign keys to the address table and the store table where this customer is registered.\n\nBasic information about the customer like first and last name are stored in the table itself. Same for the date the record was created and when the information was last updated.'

SQL script execution finished: statements: 3 succeeded, 1 failed

2
  • 1
    the error message seems quite straightforward... Aug 26, 2010 at 0:32
  • You never actually asked a question.
    – Serplat
    Aug 26, 2010 at 0:32

2 Answers 2

7

As an addition: More current versions (5.6.X) allow longer comments. Unfortunately this length differs from the type of comment:

For tables: "A comment for the table, up to 2048 characters long."

For columns: "A comment for a column can be specified with the COMMENT option, up to 1024 characters long."

For INDEX: "In MySQL 5.6, index definitions can include an optional comment of up to 1024 characters."

For PARTITION: "Beginning with MySQL 5.6.6, the maximum length for a partition comment is 1024 characters. (Previously, this limit was not explicitly defined.)"

Source: http://dev.mysql.com/doc/refman/5.6/en/create-table.html

1
  • 1
    It seems to differ for the COMMENT string in stored procedures though ... I have 2 MySQL servers (essentially hosting identical databases) and when I put the stored procedure on one the creation failed when the comment was 77 characters but was fine with 63 ... the other server was happy with 77. Fractionally different SQL versions (since one's on Debian and their version of the stack).
    – CD001
    Dec 4, 2013 at 14:57
3

As stated in the MySQL docs, a comment is limited to 255 characters: http://dev.mysql.com/doc/refman/5.1/en/create-table.html#id3411882. Your comment is 305 characters, and it would seem, from the error message, that your particular MySQL install has a 60 character limit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.