On Dec 13, 2007 4:18 PM, Daniel Mikic <daniel.mikic@logical-line.de> wrote:
>
> Baron Schwartz wrote:
>
> Hi,
>
> On Dec 13, 2007 3:53 PM, Daniel Mikic <daniel.mikic@logical-line.de> wrote:
>
>
> Hi, i hit a weird behavior:
>
> select date(null); #result is null
> select if(date(null) is null, 1, 2); #result is 2 (not null)
> select if(date(null) is not null, 1, 2); #result is 1
>
> I use mysql version 5.0.32-Debian_7etch1-log.
>
> Is this a bug and if not, can anyone explain why?
>
> Seems to be a bug, but I can't reproduce on
> 5.0.45-Debian_1ubuntu3-log, where it works correctly.
>
> What do you get from this?
>
> mysql> select date(null) is null;
> +--------------------+
> | date(null) is null |
> +--------------------+
> | 1 |
> +--------------------+
> 1 row in set (0.00 sec)
>
>
> Hi, here is the result:
>
> db2:~# mysql
> Welcome to the MySQL monitor. Commands end with ; or \g.
> Your MySQL connection id is 1909348
> Server version: 5.0.32-Debian_7etch1-log Debian etch distribution
>
> Type ';' or '\h' for . Type '\c' to clear the buffer.
>
> mysql> select date(null) is null;
> +--------------------+
> | date(null) is null |
> +--------------------+
> | 0 |
> +--------------------+
> 1 row in set (0.00 sec)
>
Definitely a bug. I'd see if it's been reported at
http://bugs.mysql.com/ and if not, report it anyway. If it has been
fixed "accidentally" there may not be a test case to prevent it from
happening in the future.