Skip to content

source-*: check rows.Err() after all rows.Next() loops#4233

Merged
Alex-Bair merged 1 commit intomainfrom
bair/source-{sql}-check-rows-err-after-iteration
Apr 14, 2026
Merged

source-*: check rows.Err() after all rows.Next() loops#4233
Alex-Bair merged 1 commit intomainfrom
bair/source-{sql}-check-rows-err-after-iteration

Conversation

@Alex-Bair
Copy link
Copy Markdown
Member

Description:

Per Go's database/sql docs, rows.Next() returns false both when the result set is exhausted and when an error is encountered. rows.Err() must be checked afterward to distinguish the two cases. Without this check, a mid-iteration error causes the function to return success with a partial result set.

Notes for reviewers:

There are also materializations that aren't checking rows.Err() after iterating through rows.Next(), but I'm going to split those off into a different PR for the materialization team to review.

Per Go's database/sql docs, `rows.Next()` returns false both when the
result set is exhausted and when an error is encountered. `rows.Err()`
must be checked afterward to distinguish the two cases. Without this
check, a mid-iteration error causes the function to return success
with a partial result set.
@Alex-Bair Alex-Bair marked this pull request as ready for review April 13, 2026 19:57
@Alex-Bair Alex-Bair requested a review from a team April 13, 2026 19:57
Copy link
Copy Markdown
Member

@willdonnelly willdonnelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

If I'm reading this correctly it looks like there's one significant data-correctness issue fixed here (in the source-oracle backfill code) and the rest is all discovery/prerequisites/diagnostics (which are still good to detect errors on, but significantly less likely to cause real user harm). That's better than I expected!

@Alex-Bair Alex-Bair merged commit c71f35f into main Apr 14, 2026
66 of 70 checks passed
@Alex-Bair Alex-Bair deleted the bair/source-{sql}-check-rows-err-after-iteration branch April 14, 2026 12:50
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.

2 participants