SQLite:或和|

SQLite: OR and |

以下查询在 SQL 服务器中有效,但在 SQLite 3.8.7 中无效,我想知道为什么。

Table

l | r
0 | 10
0 | 2
8 | 10

查询

SELECT * FROM Segments AS s1
LEFT JOIN Segments AS s2
    ON ((s2.l <= s1.l AND s2.r > s1.r)
        OR (s2.l < s1.l AND s2.r >= s1.r));

预期输出

s1.l | s1.r | s2.l | s2.r
0    | 10   | null | null
0    | 2    | 0    | 10
8    | 10   | 0    | 10

不过我得到了

 s1.l | s1.r | s2.l | s2.r
 0    | 10   | 0    | 2
 0    | 2    | 0    | 10
 8    | 10   | 0    | 10

当我切换表达顺序时,即

((s2.l < s1.l AND s2.r >= s1.r) (s2.l <= s1.l AND s2.r > s1.r))

我得到了

s1.l | s1.r | s2.l | s2.r
0    | 10   | 8    | 10
0    | 2    | 0    | 10
8    | 10   | 0    | 10

这已通过使用 | 解决而不是 OR,但我想知道为什么 OR 不起作用?

这是 SQLFiddle 上的示例 http://sqlfiddle.com/#!7/15859/22/1

谢谢

这是在 SQLite 3.8.7.2 中修复的 bug