SQLite

View Ticket
Login
2014-03-05
15:07 Fixed ticket [31a19d11]: Name resolution issue with compound SELECTs and Common Table Expressions plus 4 other changes (artifact: 833b3cf1 user: drh)
2014-02-10
18:56
Fix the compound-select-to-subquery converter so that it works with the new compound-select object linkage introduced as part of the fix for ticket [31a19d11b97088296]. (check-in: 572d4be4 user: drh tags: trunk)
2014-02-09
18:02
Use the WITH clause to help resolve names for SELECT statements on the left of a compound query. Proposed fix for ticket [31a19d11b97088296a]. (check-in: 67bfd59d user: drh tags: trunk)
02:15 New ticket [31a19d11] Name resolution issue with compound SELECTs and Common Table Expressions. (artifact: 04200414 user: drh)

Ticket Hash: 31a19d11b97088296ac104aaff113a9790394927
Title: Name resolution issue with compound SELECTs and Common Table Expressions
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2014-03-05 15:07:06
Version Found In: 3.8.3
User Comments:
drh added on 2014-02-09 02:15:05:

SELECT statements in a compound SELECT other than the right-most SELECT are unable to use common table expressions. Example:

WITH RECURSIVE
  t1(x) AS (VALUES(2) UNION ALL SELECT x+2 FROM t1 WHERE x<20),
  t2(y) AS (VALUES(3) UNION ALL SELECT y+3 FROM t2 WHERE y<20)
SELECT x FROM t1 EXCEPT SELECT y FROM t2 ORDER BY 1;

The query above is suppose to return all even integers less than 20 that are not divisible by 3. But instead we get a message: "no such table: t1".