PRAGMA reverse_unordered_selects
When enabled, this PRAGMA causes many SELECT statements without an ORDER BY clause to emit their results in the reverse order from what they normally would.
PRAGMA reverse_unordered_selects; PRAGMA reverse_unordered_selects = boolean;
On the sample database
What PRAGMA reverse_unordered_selects returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:
| reverse_unordered_selects |
|---|
| 0 |
What the SQLite documentation says
When enabled, this PRAGMA causes many SELECT statements without an ORDER BY clause to emit their results in the reverse order from what they normally would. This can help debug applications that are making invalid assumptions about the result order. The reverse_unordered_selects pragma works for most SELECT statements, however the query planner may sometimes choose an algorithm that is not easily reversed, in which case the output will appear in the same order regardless of the reverse_unordered_selects setting.
SQLite makes no guarantees about the order of results if a SELECT omits the ORDER BY clause. Even so, the order of results does not change from one run to the next, and so many applications mistakenly come to depend on the arbitrary output order whatever that order happens to be. However, sometimes new versions of SQLite will contain optimizer enhancements that will cause the output order of queries without ORDER BY clauses to shift. When that happens, applications that depend on a certain output order might malfunction. By running the application multiple times with this pragma both disabled and enabled, cases where the application makes faulty assumptions about output order can be identified and fixed early, reducing problems that might be caused by linking against a different version of SQLite.
From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.