Repository navigation
fix: Return NA for zero and partial zero dates - #598
Merged
Merged
Conversation
DATE, DATETIME and TIMESTAMP values with a zero year, month, or day are not valid dates and were converted to nonsensical values. They are now returned as `NA`. TIME values are unaffected. Closes #595 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
This was referenced Nov 29, 2026
krlmlr
marked this pull request as ready for review
November 29, 2026 12:01
krlmlr
pushed a commit
that referenced
this pull request
Nov 29, 2026
Resolve the conflict in src/MariaRow.cpp by keeping this branch's version, which no longer converts MYSQL_TIME values. Port the zero-date rule of #598 to MariaChunk::value_real(), which serves element access, regions, and materialization of DATE and DATETIME columns: a year, month, or day of 0 yields NA, TIME is unaffected. Add a test that reads zero dates from the unconverted ALTREP columns by element access and after materialization. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
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.
Closes #595.
MariaRow::value_date()andMariaRow::value_date_time()now returnNA_real_when the year, month or day of theMYSQL_TIMEis 0. Zero dates (0000-00-00) and partial zero dates (2020-00-00) are allowed with a permissivesql_mode. They were passed todays_from_civil()as is and came back as year -1. TIME values are unaffected.New
tests/testthat/test-zero-dates.Rcovers DATE, DATETIME and TIMESTAMP withsql_mode = '': zero and partial zero values give NA, including a zero date with a non-zero time (0000-00-00 12:00:00), and a valid value is unchanged. It does not test a partial zero TIMESTAMP, because the server may reject it. The full suite passes locally against MariaDB 10.11.This touches the same function that the ALTREP redesign in #587 rewrites. The check will be carried over there.
https://claude.ai/code/session_01Hr1rd7atAZVq1J42WzXJpS
Generated by Claude Code