Sotomajor.org.ua - development, photography and a lot of stuff: NOT precedence in MySQL 4.1 and 5.1

Be aware that default precedence of NOT operator in MySQL 5 was decreased. Found it during one bugfix and if I knew that before, life could be much easier :-) Details inside.
corner icon
Vienna 2010.08.07 Майдан 2010.07.14 Замки під Львовом. Занедбані і не дуже Zacharovana Desna 2010 -> OMG! I can't believe my eyes. 2010.06.05 Винниченко Володимир - Між двох сил 2010.06.18 Lohika Company Day Lviv at night

NOT precedence in MySQL 4.1 and 5.1

2010-03-26 17:08 // // Section:

Be aware that default precedence of NOT operator in MySQL 5 was decreased. Found it during one bugfix and if I knew that before, life could be much easier :-)


mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 5.1.37-1ubuntu5.1 |
+-------------------+
1 row in set (0.00 sec)

mysql> SELECT NOT 1 BETWEEN -5 AND 5;
+------------------------+
| NOT 1 BETWEEN -5 AND 5 |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)

------------------------------------------------------

mysql> select version();
+---------------------+
| version()           |
+---------------------+
| 4.1.22-standard-log |
+---------------------+
1 row in set (0.00 sec)

mysql> SELECT NOT 1 BETWEEN -5 AND 5;  
+------------------------+
| NOT 1 BETWEEN -5 AND 5 |
+------------------------+
|                      1 |
+------------------------+
1 row in set (0.00 sec)

Further reading about:

Add a comment: