Hi Barry,

This is what I get:

mysql> CREATE TABLE a ( t TIMESTAMP );
Query OK, 0 rows affected (0.25 sec)

mysql> SELECT * FROM a WHERE t > '0001-01-01 00:00:00';
Empty set, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+-------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '0001-01-01 00:00:00' for column 't' at row 1 |
+---------+------+-------------------------------------------------------------------------+
1 row in set (0.00 sec)

You can see MySQL complaining about the time format.

Although I am using .NET, I am not using any windows code. This is MySQL on UNIX and .NET under Mono/Linux.

As I said, this warning is annoying. It falls on a bug in the .NET MySQL library and causes it to crash nastily.

Personally it annoys me because this warning is a bit of a misnomer. I am not assigning this value, only comparing to it...

(I know that TIMESTAMP has a far smaller date range than DATETIME. But all our data has to be time-zone independent. Therefore TIMESTAMP is the only field appropriate for our use.)

But this is not a 'religious' thing. We can easily code around it. Until we hit a place we have forgotten this and crash Mono...

So, I am only asking nicely to any kind MySQL developer on this list, please remove this warning :)

Ben




Barry wrote:
Ben Clewett schrieb:
Hi Barry,

This will happen when comparing against a TIMESTAMP field.

CREATE TABLE a ( t TIMESTAMP );

SELECT * FROM a WHERE t > '0001-01-01 00:00:00';


Well my msql doesn't give me any errors using that query.
neither a warning.

This "might" be a problem with windows.
Windows has his problem using dates before 1st april 1970.

Probably this is here going wrong.

you can "always" compare ISO datetime formats to timestamps, Datetime fields or whatever.

Barry


--
Ben Clewett
+44(0)1923 460000
Project Manager
Road Tech Computer Systems Ltd
http://www.roadrunner.uk.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to