Repository navigation
feat!: Fail on infinite numbers instead of writing NULL - #636
Conversation
Binding `Inf` or `-Inf` in numeric columns now fails instead of writing `NULL`, in `dbBind()`, `sqlData()`, `dbWriteTable()`, and `dbAppendTable()`, also with `load_data_local_infile = TRUE`. `NaN` and `NA` are still written as `NULL`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd5PUWgaCJzotWt9NhJ
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd5PUWgaCJzotWt9NhJ
Superseded: Accepted limitationsThe clean review found nothing above Low. It confirmed that no DBItest spec writes One Low is fixed anyway, because it could lose data.
Generated by Claude Code |
…o claude/bind-nonfinite-numbers # Conflicts: # tests/testthat/test-bind-nonfinite.R
…o claude/bind-nonfinite-numbers # Conflicts: # tests/testthat/test-bind-nonfinite.R
Accepted limitationsThe clean review found nothing above Low. It confirmed that no DBItest spec writes
Generated by Claude Code |
|
Resolve stack conflicts. |
…o claude/bind-nonfinite-numbers
|
Done. The latest Generated by Claude Code |
…numbers Since the data is computed only once, the check runs on the bound parameters, which label columns by position. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd5PUWgaCJzotWt9NhJ
|
The red smoke test on b0743c7 (job) came from Generated by Claude Code |
Stacked on #623. This is the breaking part of the decision on #623 ("Fail on
Inf/-Infin both time and numeric columns"), kept in its own PR as asked.Before this change,
numeric_to_finite()wroteInfand-Infin numeric columns asNULL, without a warning. They now fail with "Can't represent N infinite numeric value(s) in column(s)x: useNAfor missing values.", on every write path:dbBind(),sqlData(),dbAppendTable()anddbWriteTable(), both with prepared statements and withload_data_local_infile = TRUE.NAandNaNare still written asNULL. The message labels columns as #623's errors do, by name or by position, through a sharedcolumn_labels()helper.The commit body carries the NEWS line: "Binding Inf or -Inf in numeric columns now fails instead of writing NULL."
Tests
tests/testthat/test-bind-nonfinite.Rgains tests for numeric columns throughdbBind(),sqlData()andload_data_local_infile. Each failing write checks that the table still has 0 rows.tests/testthat/test-dbWriteTable.R's "converts NaN and Inf to NULL" is split into "converts NaN to NULL" and "fails on Inf".The local test server is down, so the database tests have not run here yet; CI runs them. The package builds. The error texts, column labels, and the handling of
NA,NaN,POSIXlt,AsIsandinteger64were checked by callingnumeric_to_finite(),sql_data()andcsv_quote()directly.Accepted limitations
Session: https://claude.ai/code/session_01Hr1rd5PUWgaCJzotWt9NhJ
Generated by Claude Code