SQLite

View Ticket
Login
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: (text/x-fossil-wiki)
SELECT statements in a compound SELECT other than the right-most SELECT are
unable to use common table expressions.  Example:

<blockquote><verbatim>
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;
</verbatim></blockquote>

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".