Bug in ALL/ANY/SOME/IN operators and NULL value ?
am 30.11.2002 15:33:47 von Jocelyn FournierHi,
I'm wondering whether the following is a bug.
How-to-repeat :
mysql> SELECT 1 as a,1=ALL(SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE
a=0);
+---+------------------------------------------------------- --+
| a | 1=ALL(SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE a=0) |
+---+------------------------------------------------------- --+
| 1 | 1 |
+---+------------------------------------------------------- --+
1 row in set (0.00 sec)
The second column should be NULL ?
mysql> SELECT 1 as a,1=SOME(SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE
a=0);
+---+------------------------------------------------------- ---+
| a | 1=SOME(SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE a=0) |
+---+------------------------------------------------------- ---+
| 1 | 0 |
+---+------------------------------------------------------- ---+
1 row in set (0.00 sec)
Same here.
mysql> SELECT 1 as a,1 IN (SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE
a=0);
+---+------------------------------------------------------- --+
| a | 1 IN (SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE a=0) |
+---+------------------------------------------------------- --+
| 1 | 0 |
+---+------------------------------------------------------- --+
1 row in set (0.00 sec)
Here too ?
Indeed :
mysql> SELECT 1 as a,(SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE a=0);
+---+----------------------------------------------------+
| a | (SELECT 1 IN (SELECT 1) FROM (SELECT 1) WHERE a=0) |
+---+----------------------------------------------------+
| 1 | NULL |
+---+----------------------------------------------------+
1 row in set (0.00 sec)
And :
mysql> SELECT 1=ALL(SELECT NULL);
+--------------------+
| 1=ALL(SELECT NULL) |
+--------------------+
| NULL |
+--------------------+
1 row in set (0.00 sec)
mysql> SELECT 1=SOME(SELECT NULL);
+---------------------+
| 1=SOME(SELECT NULL) |
+---------------------+
| NULL |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT 1 IN (SELECT NULL);
+--------------------+
| 1 IN (SELECT NULL) |
+--------------------+
| NULL |
+--------------------+
1 row in set (0.00 sec)
BTW, the <=> operator seems to not be supported with ALL/ANY/SOME ?
mysql> SELECT 1<=>ALL(SELECT NULL);
ERROR 1064: You have an error in your SQL syntax. Check the manual that
corresponds to your MySQL server version for the right syntax to use near
'ALL(SELECT NULL)' at line 1
Regards,
Jocelyn
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread13167@lists.mysql.com
To unsubscribe, e-mail