/ View Ticket
Login
2014-04-21
13:39 Fixed ticket [b75a9ca6]: ORDER BY ignored if query has identical GROUP BY plus 5 other changes (artifact: c5dd2e0d user: drh)
13:36
Comment tweaks on the test case for the [b75a9ca6b0] bug fix. (check-in: 65d2544a user: drh tags: trunk)
13:21
Avoid discarding an ORDER BY clause in the case where an identical GROUP BY clauses uses an index to group, but not sort, the rows. Fix for [b75a9ca6b0]. (check-in: de9a490f user: dan tags: trunk)
2014-04-20
09:57 Closed ticket [14b9ffb6]: An ORDER BY clause with the same expressions as a GROUP BY clause may be ignored plus 6 other changes (artifact: 9dcbc965 user: drh)
09:34 New ticket [b75a9ca6] ORDER BY ignored if query has identical GROUP BY. (artifact: 886cb1c9 user: drh)

Ticket Hash: b75a9ca6b04991dd593c472f56ce88a59d4f131c
Title: ORDER BY ignored if query has identical GROUP BY
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2014-04-21 13:39:44
Version Found In: 3.8.4.3
User Comments:
drh added on 2014-04-20 09:34:23:

In the query at the end of the following code, the ORDER BY clause is ignored and the results appear in the wrong order:

CREATE TABLE t1(x,y);
INSERT INTO t1 VALUES(1,1),(2,0);
CREATE INDEX t1yx ON t1(y,x);
SELECT x,y FROM t1 GROUP BY x, y ORDER BY x, y;

This problem appears to have been introduced into trunk by the cutover to the next generation query planner in check-in [0fe31f60cadc5fe5a9d] on 2013-06-26.