Conversation
Collaborator
|
Review requested:
|
Closing a virtual table cursor invoked the iterator's return() even after next() had already reported done: true, deviating from for...of semantics where return() only runs on abrupt termination. An empty custom iterable with a throwing return() made an otherwise successful query fail. Only close the iterator when the scan stopped early, as with LIMIT, a break, or a cursor re-filter; a normally finished iterator already ran its cleanup. Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Assisted-by: claude:opus-5.5
trivikr
force-pushed
the
sqlite-exhausted-iterators-return-2
branch
from
October 5, 2026 16:37
bbd7a1b to
5925401
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66519 +/- ##
==========================================
- Coverage 92.74% 90.40% -2.35%
==========================================
Files 422 791 +369
Lines 193170 275991 +82821
Branches 29783 52980 +23197
==========================================
+ Hits 179160 249505 +70345
- Misses 13682 16902 +3220
- Partials 328 9584 +9256
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #66518
Once a virtual table iterator's
next()reportsdone: true, the iterator is finished, soreturn()must not be called. This matchesfor...of, which callsreturn()only on abrupt termination. Before this change, an empty custom iterable with a throwingreturn()made an otherwise successful query fail.CloseIterator()now skips cursors whose iteration has completed. That covers bothxCloseand cursor re-filtering. Early termination (LIMIT,break, re-filter mid-scan) still callsreturn().Assisted-by: claude:opus-5.5