SQLite Forum

inner join bug with compound queries
Login
This query gives the wrong answer on 3.35.x and I think 3.36. It's quite resistant to further reduction.

```
.version
WITH
T1 (x) AS (SELECT 10),
T2 (y) AS (SELECT 1),
T3 (z) AS (
  SELECT * FROM T2 WHERE 0
  UNION ALL
  SELECT * FROM T2
)
SELECT *
  FROM T1
  INNER JOIN T2
  INNER JOIN T3;
SELECT 'done'
```

It should return a single row.

```
SQLite 3.32.3 2020-06-18 14:16:19 02c344aceaea0d177dd42e62c8541e3cab4a26c757ba33b3a31a43ccc7d4aapl
clang-12.0.5
10|1|1
done
```

However 3.35.x returns no rows.

```
SQLite 3.35.5 2021-04-19 18:32:05 1b256d97b553a9611efca188a3d995a2fff712759044ba480f9a0c9e98fae886
clang-12.0.5
done
```

It might be further reducible but it is touchy.  Even some of that goofy looking stuff seems to be necessary (it's less goofy in the original context).

One of the guys here tried 3.36 and it also had the same issue.