/ Ticket Change Details
Login
Overview

Artifact ID: 614870a83e6b79cb97462eb5cea293864999a071db7c893a9ffeb07164720b9b
Ticket: 510cde277783b5fb5de628393959849dff377eb3
Endless loop on a query with window functions, ORDER BY, and LIMIT
User & Date: drh 2018-09-17 14:28:12
Changes

  1. foundin changed to: "3.25.0"
  2. icomment:
    The following query hits an assert() in the byte-code engine, or if assert()s
    are disabled, goes into an endless loop in the byte code.
    
    <blockquote><verbatim>
    CREATE TABLE t1(id, b, c);
    INSERT INTO t1 VALUES(1, 'A', 'one');
    INSERT INTO t1 VALUES(2, 'B', 'two');
    INSERT INTO t1 VALUES(3, 'C', 'three');
    INSERT INTO t1 VALUES(4, 'D', 'one');
    INSERT INTO t1 VALUES(5, 'E', 'two');
    SELECT id, b, lead(c,1) OVER(ORDER BY c) AS x FROM t1 WHERE id>1 ORDER BY b LIMIT 1;
    </verbatim></blockquote>
    
    This problem appears to have been introduced by check-in
    [206720129ed2fa8875a2] which was a fix for ticket
    [9936b2fa443fec03ff25] which was the previous problem of an
    endless loop due to the ORDER BY LIMIT optimization.
    
  3. login: "drh"
  4. mimetype: "text/x-fossil-wiki"
  5. severity changed to: "Severe"
  6. status changed to: "Open"
  7. title changed to:
    Endless loop on a query with window functions, ORDER BY, and LIMIT
    
  8. type changed to: "Code_Defect"