Overview
Artifact ID: | fc35a8b205d8e834b88322e2c79eb5e6d8b0b778 |
---|---|
Ticket: | f97c4637102a3ae72b7911167e1d4da12ce60722
Incorrect ordering with ORDER BY and LIMIT |
User & Date: | drh 2015-01-19 15:31:16 |
Changes
- foundin changed to: "3.8.8"
- icomment:
The following SQL outputs rows in the incorrect order for SQLite versions 3.8.7 and 3.8.8: <blockquote><verbatim> CREATE TABLE t1(x); INSERT INTO t1(x) VALUES(1),(5),(3),(4),(2); SELECT x, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 FROM t1 ORDER BY x LIMIT -1; </verbatim></blockquote> In order to hit this bug, there must be an ORDER BY clause and a LIMIT clause and the number of columns in the query plus the number of sort keys needs to sum to exactly 62. Adding or removing a single column from the result set yields the correct answer. This bug first appeared in check-in [b1c0f0bc1bd8a] which is when the multi-threaded sorter was introduced.
- login: "drh"
- mimetype: "text/x-fossil-wiki"
- severity changed to: "Severe"
- status changed to: "Open"
- title changed to: "Incorrect ordering with ORDER BY and LIMIT"
- type changed to: "Code_Defect"