PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > mysql.general > Weird behavior with date(null) and if
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Weird behavior with date(null) and if

Réponse
 
LinkBack Outils de la discussion
Vieux 13/12/2007, 20h53   #1
Daniel Mikic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Weird behavior with date(null) and if

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?

Thanks,

Daniel

  Réponse avec citation
Vieux 13/12/2007, 21h08   #2
Baron Schwartz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Weird behavior with date(null) and if

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)
  Réponse avec citation
Vieux 13/12/2007, 21h18   #3
Daniel Mikic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Weird behavior with date(null) and if

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)

Thanks

Daniel




  Réponse avec citation
Vieux 13/12/2007, 21h28   #4
Baron Schwartz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Weird behavior with date(null) and if

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.
  Réponse avec citation
Vieux 14/12/2007, 09h56   #5
Daniel Mikic
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Weird behavior with date(null) and if

Baron Schwartz schrieb:
> 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.
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=d...ogical-line.de
>
>
>

Hi, this bug was fixed with version 5.0.36.

http://bugs.mysql.com/bug.php?id=23938

Thanks

Daniel

--

Mit freundlichen Grüßen

Daniel Mikic
IT-Leiter / CIO

logical line GmbH
Hamburger Allee 23
30161 Hannover
HRB 56320/AG Hannover
Geschäftsführer: Dr. Rüdiger Lemke
www.logicalline.com
Fon: +49 511 936 208 - 32
Fax: +49 511 936 208 - 11



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 21h41.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13814 seconds with 13 queries