Invalid default value for ENUM fields

Discussion of open issues, suggestions and bugs regarding database management and administration tools for MySQL
Post Reply
mommaroodles
Posts: 7
Joined: Tue 09 Sep 2014 14:15

Invalid default value for ENUM fields

Post by mommaroodles » Mon 15 Sep 2014 07:09

Hi

I am experiencing the identical problem to this which was reported as a mysql bug in 2009.

I cannot set the default value of the products_tax column to 10.00.

http://bugs.mysql.com/bug.php?id=44368

Code: Select all

CREATE TABLE orders_products (
  orders_products_id mediumint(6) UNSIGNED NOT NULL AUTO_INCREMENT,
  orders_id mediumint(5) UNSIGNED NOT NULL DEFAULT 0,
  products_id mediumint(5) UNSIGNED NOT NULL DEFAULT 0,
  products_model varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  products_name tinytext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  products_price decimal(13, 2) UNSIGNED NOT NULL DEFAULT 0.00,
  final_price decimal(13, 2) NOT NULL DEFAULT 0.00,
  products_tax enum ('0.00', '10.00') NOT NULL DEFAULT 10.00,
  products_quantity int(2) UNSIGNED NOT NULL DEFAULT 0,
  PRIMARY KEY (orders_products_id)
)
ENGINE = INNODB
AUTO_INCREMENT = 2174104
AVG_ROW_LENGTH = 156
CHARACTER SET utf8
COLLATE utf8_unicode_ci;

mommaroodles
Posts: 7
Joined: Tue 09 Sep 2014 14:15

Re: Invalid default value for ENUM fields

Post by mommaroodles » Mon 15 Sep 2014 07:13

In other owords what I am trying to do is the following

ALTER TABLE `orders_products` CHANGE `products_tax` `products_tax` ENUM( '0.00', '10.00' ) NOT NULL DEFAULT '10.00';

This can be done in phpmyadmin but not dbforge

alexa

Re: Invalid default value for ENUM fields

Post by alexa » Mon 15 Sep 2014 09:40

We are currently investigating this issue and will answer you as soon as possible.

alexa

Re: Invalid default value for ENUM fields

Post by alexa » Wed 24 Sep 2014 14:21

Such a behavior is by design.

We recommend you to enclose a default value in quotes.

Post Reply