MySQL Forums
Forum List  »  MySQL Workbench

Error loading script from workbench with TIMESTAMP default value
Posted by: Diego Rosado
Date: September 05, 2008 06:29AM

I have created a model on Mysql Workbench and exported it to a SQL script using forward engineer SQL CREATE Script...

I try to load the script using
1) mysql command line: mysql ... < file.sql
2) LOAD DATA INFILE 'file.sql'

on both cases get the same error: ERROR 1067 ... Invalid default value for TAG_TS (First TIMESTAMP FIELD)

The code that provoques the error is


DROP TABLE IF EXISTS `mydb`.`inventory` ;

CREATE TABLE IF NOT EXISTS `mydb`.`inventory` (
`tag_id` VARBINARY(48) NOT NULL ,
`ITEM_ID` INT(11) NOT NULL COMMENT 'Identificador unico del elemento del Cliente' ,
`ZONE_ID` INT(11) NOT NULL COMMENT 'Codigo de identificacion de zona' ,
`LEVEL_ID` INT(11) NOT NULL ,
`TAG_TS` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00' ,
`TS` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
PRIMARY KEY (`tag_id`) ,
UNIQUE INDEX ITEM_ID (`ITEM_ID` ASC) ,
INDEX Inventory_Zone_FK (`ZONE_ID` ASC) ,
INDEX Inventory_SecurityLevel_FK (`LEVEL_ID` ASC) ,
CONSTRAINT `Inventory_Zone_FK`
FOREIGN KEY (`ZONE_ID` )
REFERENCES `mydb`.`zone` (`ZONE_ID` )
ON DELETE RESTRICT
ON UPDATE RESTRICT,
CONSTRAINT `Inventory_SecurityLevel_FK`
FOREIGN KEY (`LEVEL_ID` )
REFERENCES `mydb`.`security_level` (`LEVEL_ID` )
ON DELETE RESTRICT
ON UPDATE RESTRICT)
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1
COMMENT = 'Listado de elementos registrados en el sistema relacionados ';

As you can see it has two TIMESTAMP fields but just one have default value to CURRENT_TIMESTAMP.

If I paste this code at mysql it creates the table with no problem.

The Workbench version is: 5.0.24 OSS Rev 3407
Mysql Version: Ver 14.12 Distrib 5.0.41, for Win32 (ia32)

Thanks in advance

Options: ReplyQuote


Subject
Views
Written By
Posted
Error loading script from workbench with TIMESTAMP default value
6437
September 05, 2008 06:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.