SQLite

Ticket Change Details
Login
Overview

Artifact ID: 1f188ca25a2a7175d6be59dd21c95984c2cd1ea564fc291c8180b4619dda9e07
Ticket: 9cdc5c4662d4063771d45d2893b294df0e868001
Incorrect result from second execution of correlated scalar sub-query that uses a partial sort
User & Date: dan 2019-06-26 20:00:00
Changes

  1. icomment:
    <verbatim>
    CREATE TABLE t1(x);
    INSERT INTO t1 VALUES('ALFKI');
    INSERT INTO t1 VALUES('ANATR');
    
    CREATE TABLE t2(y, z);
    CREATE INDEX t2y ON t2 (y);
    INSERT INTO t2 VALUES('ANATR', '1997-08-08 00:00:00');
    INSERT INTO t2 VALUES('ALFKI', '1997-08-25 00:00:00');
    
    SELECT (
      SELECT y FROM t2 WHERE x = y ORDER BY y, z
    )
    FROM t1;
    </verbatim>
    
    The script above should return two rows - one with 'ANATR' and a second with 'ALFKI'. Instead it returns 'ANATR' and then NULL.
    
    Problem introduced by commit [4678cb1044f0b].
    
  2. login: "dan"
  3. mimetype: "text/x-fossil-wiki"
  4. severity changed to: "Critical"
  5. status changed to: "Open"
  6. title changed to:
    Incorrect result from second execution of correlated scalar sub-query that uses a partial sort
    
  7. type changed to: "Code_Defect"