This problem appears to have been introduced on 2014-08-29 14:20:46 by
check-in [2a74129a21f], though it is unclear if that check-in actually caused
the problem or just unmasked it.
The problem appears to be cause by misbehavior in the
partial sorting by index
optimization.

drh added on 2016-01-13 15:21:24:

The simple work-around to this problem is to not over-constraint ORDER BY
clauses. Do not write:

SELECT x FROM ... ORDER BY x, y, z;

The extra "y" and "z" terms on the ORDER BY are pointless as the "ORDER BY x" is sufficient to completely define the output order. So instead write:

SELECT x FROM ... ORDER BY x;

SQLite ought to give the correct answer in either case. And apparently it always does in the second case. The bug here is that sometimes the first case gives an incorrect result.

This page was generated in about
0.017s by
Fossil version 2.4 [0b4c3f5a28] 2017-09-26 20:41:54