Hi there,
A bug was fixed in 4.0.23:
* Fixed bug which caused FROM_UNIXTIME() function to return wrong result if the argument was too big. http://bugs.mysql.com/6439
However, it looks like it has side effects:
select FROM_UNIXTIME(0) returns "1970-01-01 01:00:00" in 4.0.22 but NULL in 4.0.23... (European localtime)
Needless to say, this confuses application logic (especially if the type is DATETIME NOT NULL).
Is this a bug? Should I file a bug at http://bugs.mysql.com/ ?
If it was intentional, wouldn't it have been prudent to mention this altered behavior in the release notes?
Peter
************************ To reproduce: ************************ SELECT FROM_UNIXTIME(0);
CREATE TABLE `fromunixtime1` ( `timestamp` TIMESTAMP NOT NULL ); INSERT INTO `fromunixtime1` (`timestamp`) values (FROM_UNIXTIME(0)); SELECT `timestamp` FROM `fromunixtime1`;
CREATE TABLE `fromunixtime2` ( `datetime` DATETIME NOT NULL ); INSERT INTO `fromunixtime2` (`datetime`) values (FROM_UNIXTIME(0)); SELECT `datetime` FROM `fromunixtime2`;
************************ 4.0.22 output: ************************ +---------------------+ | FROM_UNIXTIME(0) | +---------------------+ | 1970-01-01 01:00:00 | +---------------------+ 1 row in set (0.00 sec) +----------------+ | timestamp | +----------------+ | 00000000000000 | +----------------+ 1 row in set (0.00 sec) +---------------------+ | datetime | +---------------------+ | 1970-01-01 01:00:00 | +---------------------+ > mysql --version mysql Ver 12.22 Distrib 4.0.22, for pc-linux (i386) (Debian unstable - "a couple of days ago") ************************ 4.0.23 output: ************************ +------------------+ | FROM_UNIXTIME(0) | +------------------+ | NULL | +------------------+ 1 row in set (0.00 sec) +----------------+ | timestamp | +----------------+ | 20041228151915 | +----------------+ 1 row in set (0.00 sec) ERROR 1048: Column 'datetime' cannot be null Empty set (0.00 sec) > mysql --version mysql Ver 12.22 Distrib 4.0.23, for pc-linux-gnu (i386) (Debian unstable - present)
-- Peter Valdemar Mørch http://www.morch.com
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.298 / Virus Database: 265.6.5 - Release Date: 12/26/2004
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]