SQLite

Ticket Change Details
Login
Overview

Artifact ID: b556e7c9998dd37c6efa6c9663998d510316cb52
Ticket: 98825a79ce145686392d8074032ae54863aa21a3
Incorrect result from a DISTINCT + GROUP BY + ORDER BY query
User & Date: drh 2014-04-03 15:17:34
Changes

  1. foundin changed to: "3.8.4.2"
  2. icomment:
    The following query answers 'wrong' even though the correct answer is 'right':
    
    <blockquote><verbatim>
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES('right'),('wrong');
    SELECT DISTINCT x
     FROM (SELECT x FROM t1 GROUP BY x)
     WHERE x='right'
     ORDER BY x;
    </verbatim></blockquote>
    
    Bisecting shows that this problem was introduced by check-in
    [1e64dd782a126f48d78c4] on 2014-02-08 and first appeared in
    SQLite version 3.8.4.
    
  3. login: "drh"
  4. mimetype: "text/x-fossil-wiki"
  5. severity changed to: "Critical"
  6. status changed to: "Open"
  7. title changed to:
    Incorrect result from a DISTINCT + GROUP BY + ORDER BY query
    
  8. type changed to: "Code_Defect"