/ Ticket Change Details

Artifact ID: 7da230dd8d0b01a6f5ba35a08fdeea3b0680e9f74f88173e5495266e69da272c
Ticket: 787fa716be3a7f650cac1b1413f12f95f5e7639d
Assertion fault when multi-use subquery implemented by co-routine
User & Date: drh 2018-11-08 19:27:38

  1. Change icomment to:
    This appears to have nothing to do with window functions.  The use of window
    functions in the example above merely disables the query flattener.  The
    problem can also be seen in the following query:
    CREATE TABLE t1 (a);
    CREATE TABLE t2 (b);
    CREATE TABLE t3 (c);
    CREATE TABLE t4 (d);
    INSERT INTO t1 (a) VALUES (104);
    INSERT INTO t2 (b) VALUES (104);
    INSERT INTO t3 (c) VALUES (104);
    INSERT INTO t4 (d) VALUES (104);
    -- Disable the query-flattener
    .testctrl optimizations 0x01
    SELECT *
    FROM t1 CROSS JOIN t2 ON (t1.a = t2.b) WHERE t2.b IN (
      SELECT t3.c
      FROM t3
      WHERE t3.c IN (
        SELECT d FROM (SELECT d FROM t4) AS innermost WHERE innermost.d=104
    The query above fails in all versions of SQLite from 3.8.11 and later.  The
    check-in that causes the failure is [020b8b106fc8f840f6b506e1c9c3b] on
  2. Change login to "drh"
  3. Change mimetype to "text/x-fossil-wiki"
  4. Change priority to "Immediate"
  5. Change resolution to "Open"
  6. Change subsystem to "Unknown"