|
|||||||||||
|
Re: multiple current_timestamp
From: Arnold Daniels <info(at)adaniels.nl>
Date: Sun Jul 29 2007 - 18:16:49 EDT
I see that I haven't made myself clear. Please take the statement to create a table below as example. CREATE TABLE `mytable` (
`id` INT UNSIGNED NOT NULL ,
`description` VARCHAR( 255 ) NOT NULL ,
`date_insert` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
`date_update` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT
CURRENT_TIMESTAMP ,
PRIMARY KEY ( `id` ) ) ENGINE = MYISAM; This triggers the error: #1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause Let's say this table does not trigger an error and I would do the following queries: INSERT INTO `mytable` (`description`) VALUES ("My first item"); UPDATE `mytable` SET `description` = "Changed my first item" WHERE `id`=1; The fields would not hold the same data. At this moment you cannot use 'ON UPDATE CURRENT_TIMESTAMP' if you also have a field like `date_insert`. Instead you need to create a trigger to do this behavior. I hope I managed to make my issue clear with this example.
Best regards,
Eric Bergen wrote:
-- MySQL Internals Mailing List For list archives: http://lists.mysql.com/internals To unsubscribe: http://lists.mysql.com/internals?unsub=lists@pantek.comReceived on Sun Jul 29 18:16:44 2007 This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:06:22 EDT |
||||||||||
|
|||||||||||