Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: multiple current_timestamp

From: Jim Winstead <jimw(at)mysql.com>
Date: Sun Jul 29 2007 - 22:53:48 EDT


On Sun, Jul 29, 2007 at 07:02:19PM -0700, Eric Bergen wrote:
> That's a much better example. It does seem very strange that the
> timestamp functionality isn't more flexible. I suspect there are other
> things wrong in that area too. While playing around with timestamp
> definitions I found that the on update timestamp column still has to
> be listed before any other timestamps.
>
> I can't find anything in the manual that says the "magic" timestamp
> column still needs to be first like it was in 4.0.

It doesn't.

mysql> create table t1 (a timestamp default 0, b timestamp

    -> on update current_timestamp);
Query OK, 0 rows affected (0.01 sec)
mysql> show create table t1\G

*************************** 1. row ***************************
       Table: t1

Create Table: CREATE TABLE `t1` (
  `a` timestamp NOT NULL default '0000-00-00 00:00:00',   `b` timestamp NOT NULL default '0000-00-00 00:00:00' on update CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=latin1

I don't know if there is a strong technical reason for only allowing a single timestamp field to be automatically set or automatically updated, or the limitation was just a carry-over from when only the first timestamp field was auto-set/update. I wouldn't expect anyone at MySQL to jump at implementing this, but a patch would be looked at. (But since you can get the same effect with a trigger, it may not have a shot.)

Jim Winstead
MySQL Inc.

-- 
MySQL Internals Mailing List
For list archives: 
http://lists.mysql.com/internals
To unsubscribe:    
http://lists.mysql.com/internals?unsub=lists@pantek.com
Received on Sun Jul 29 22:54:04 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:06:22 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library