Skip to content

fix: Iter yields all rows instead of only the first#41

Merged
klaidliadon merged 1 commit intomasterfrom
fix/iter-streaming-rows
Apr 7, 2026
Merged

fix: Iter yields all rows instead of only the first#41
klaidliadon merged 1 commit intomasterfrom
fix/iter-streaming-rows

Conversation

@klaidliadon
Copy link
Copy Markdown
Contributor

Summary

  • Bug: Iter used scany's ScanOne which closes pgx.Rows after scanning the first row, making the iterator yield only one row then stop.
  • Fix: Replace ScanOne with ScanRow, which scans the current row without closing the cursor.
  • Test: Added TestIter — inserts 100 rows, iterates with Iter, asserts count is 100.

Test plan

  • TestIter passes (100 rows streamed)
  • Full test suite passes (24 tests, 0 failures)

ScanOne closes the underlying pgx.Rows after scanning, which caused
the iterator to stop after the first row. Switch to ScanRow which
scans the current row without closing the cursor.
@klaidliadon klaidliadon merged commit 30bbcbe into master Apr 7, 2026
1 check passed
@klaidliadon klaidliadon deleted the fix/iter-streaming-rows branch April 7, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant