Merge 'btree: fix infinite looping in backwards iteration of btree table' from Jussi Saurio

Closes #1562
Existing "fuzz test" (not really fuzz, but kinda) didn't catch this due
to `LIMIT 3` clause

Closes #1563
This commit is contained in:
Jussi Saurio
2025-05-23 21:46:16 +03:00
3 changed files with 17 additions and 4 deletions

View File

@@ -199,4 +199,15 @@ do_execsql_test orderby_desc_with_filter_id_le {
6665
6664
6663
6662}
6662}
# regression test where backwards iteration used to hang indefinitely
do_execsql_test orderby_desc_regression {
select count(1) from (select * from users where id < 100 order by id desc)
} {99}
do_execsql_test orderby_desc_regression_verify_order {
select id from users where id < 100 order by id desc limit 3;
} {99
98
97}