|
From: Michel B. <mi...@bo...> - 2005-06-08 12:22:28
|
Le Mercredi 08 Juin 2005 13:46, Lionel Bouton a =E9crit :
>
> MySQL already changed its behaviour between versions regarding
> timestamps. The =A0fact that "desc from_awl" doesn't output the CREATE
> statement used by SQLgrey but a mangled one shows that MySQL
> deliberately allows itself to change the CREATE statement.
Indeed. By adding its "default behaviour" (which is to consider that the =
first=20
mentioned timestamp column [for which "default 0" is not specified (*)] i=
s=20
auto-update...)
(*) Beginning with MySQL 4.1.2 and on...
Furthermore, "desc" output is incomplete and doesn't always mention _all_=
the=20
characteristics of a given column ("on update..." isn't displayed anywher=
e by=20
desc).
=3D> If we don't want any auto-update or auto-initialization at all, we s=
hould=20
probably use the "datetime" data type, rather than "timestamp".
> I don't want to rely on the assumptions that the future MySQL versions =
won't
> introduce other on the fly modifications of CREATE statements...
Yep, but "default 0" would be harmless anyway ;-)) Yes, I know,=20
"harmless" ;-)))
...But it would prevent other manual queries that would be done on the ta=
bles=20
to cause the first_seen timestamp to be inadvertently auto-updated.
> I prefer to solve this by forcing the databases to set first_seen to th=
e
> right value on each update. At least no database seems to modify UPDATE
> statements on the fly! This is how it is done in 1.5.9.
Yes, I've checked the diff between 1.5.8 and 1.5.9.
--=20
Michel Bouissou <mi...@bo...> OpenPGP ID 0xDDE8AC6E
|