(text/x-fossil-wiki)
In the test case below, only one row is fetched, rather than two:
<pre>
CREATE TABLE t0 (c0, c1, c2, PRIMARY KEY (c0, c1));
CREATE TABLE t1 (c2);
INSERT INTO t0(c2) VALUES (0), (1), (3), (4), (5), (6), (7), (8), (9), (10), (11);
INSERT INTO t0(c1) VALUES ('a');
INSERT INTO t1(c2) VALUES (0);
ANALYZE;
SELECT DISTINCT t0.c0, t1._rowid_, t0.c1 FROM t1 CROSS JOIN t0 ON TRUE ORDER BY t0.c0; -- expected: |1|, |1|a, actual: |1|
</pre>
When removing the ANALYZE, the query works as expected. It also works when using JOIN or FROM t1, t0 rather than a CROSS JOIN.
|