List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:July 30 2007 2:53am
Subject:Re: multiple current_timestamp
View as plain text  
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.
Thread
multiple current_timestampArnold Daniels29 Jul
  • Re: multiple current_timestampEric Bergen29 Jul
    • Re: multiple current_timestampArnold Daniels30 Jul
      • Re: multiple current_timestampEric Bergen30 Jul
        • Re: multiple current_timestampJim Winstead30 Jul
          • Re: multiple current_timestampTobias Asplund30 Jul
  • Re: multiple current_timestampDmitri Lenev30 Jul
  • mmaping and index file(.MYI) in mysql 5.1.22-rc?ajay singh20 Dec