SQLite

View Ticket
Login
2010-10-06
19:14 Fixed ticket [38cb5df375]: LIMIT ignored on compound query with subqueries plus 1 other change (artifact: ed3eb2bd22 user: drh)
18:55
Fix long-standing bugs with the handling of LIMIT clausing in compound SELECT statements with FROM clause subqueries. Ticket [38cb5df375078d3f9]. (check-in: b0450120ea user: drh tags: trunk)
17:15 Ticket [38cb5df375] LIMIT ignored on compound query with subqueries status still Open with 3 other changes (artifact: 9556d4b883 user: drh)
17:06 New ticket [38cb5df375]. (artifact: 08decf09c5 user: drh)

Ticket Hash: 38cb5df375078d3f9711482d2a1615d09f6b3f33
Title: LIMIT ignored on compound query with subqueries
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2010-10-06 19:14:07
14.70 years ago
Created: 2010-10-06 17:06:47
14.70 years ago
Version Found In: 3.7.2
Description:
In the following code, multiple rows of output are generated in spite of the LIMIT 1 clause:
CREATE TABLE t(a);
INSERT INTO t VALUES(1);
INSERT INTO t VALUES(2);

SELECT * FROM (SELECT * FROM t ORDER BY a) UNION ALL SELECT * FROM (SELECT a FROM t) LIMIT 1;

This defect has been in the code going back to version 3.1.3 (2005-02-19) and probably before that.