对此感到困惑。
在两台服务器上运行相同版本的 MySQL。 (从完全相同的 rpm 构建)- 沿线的某个地方,一些开发人员改变了一些东西......
服务器 1:
mysql> select ( not 1 = 2 );
0
1 row in set (0.00 sec)
服务器 2:
mysql> select ( not 1 = 2 );
1
1 row in set (0.00 sec)
两个服务器:
mysql> sHOW VARIABLES LIKE 'version';
| version | 5.6.12 |
最佳答案
你应该检查 HIGH_NOT_PRECEDENCE
运营商。
官方文档指出:
The precedence of the NOT operator is such that expressions such as NOT a BETWEEN b AND c are parsed as NOT (a BETWEEN b AND c). In some older versions of MySQL, the expression was parsed as (NOT a) BETWEEN b AND c. The old higher-precedence behavior can be obtained by enabling the HIGH_NOT_PRECEDENCE SQL mode.
Fiddle 测试此行为 here .
顺便说一句,我建议比较 x != y
而不是使用 not (x = y)
。
关于MySQL - 真/假查询在两台服务器上返回不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20388361/