SQLite

Ticket Change Details
Login
Overview

Artifact ID: 67d7ba17159d0bbb520fedf70c8b39de0ad07933d814122096378bd2db2c45fc
Ticket: c41afac34f15781fe09cd1475601db0186b0995b
LIMIT applied globally rather than locally
User & Date: drh 2019-05-29 16:04:56
Changes

  1. foundin changed to: "3.28.0"
  2. icomment:
    In the SQL below, the "LIMIT 1" clause ends up being applied to the
    entire query, rather than to just the one subquery to which it is attached.
    
    <blockquote><verbatim>
    CREATE TABLE t1 AS VALUES(1),(2);
    CREATE TABLE t2 AS VALUES(3);
    SELECT * FROM (
      SELECT * FROM (SELECT * FROM t1 LIMIT 1)
      UNION ALL
      SELECT * from t2);
    </verbatim></blockquote>
    
    
    Bisect shows the error was introduced by check-in [67bfd59d9087a987f] (about 5.3 years
    ago) and first appeared in SQLite version 3.8.4 (2014-03-10).
    
    This problem was reported on the mailing list by Marco Foit.
    
  3. login: "drh"
  4. mimetype: "text/x-fossil-wiki"
  5. severity changed to: "Severe"
  6. status changed to: "Open"
  7. title changed to: "LIMIT applied globally rather than locally"
  8. type changed to: "Code_Defect"