Uh oh!
There was an error while loading. Please reload this page.
CommandUtils.As: accept a DateOnly source (Npgsql 10 'date' columns) - #203
Merged
Conversation
Npgsql 10 changed reader.GetValue() for a 'date' column to return DateOnly rather than DateTime; DateOnly does not implement IConvertible, so the As<DateTime[?]> fallback through Convert.ToDateTime threw InvalidCastException. Bisected empirically: the DateOnlyTimeOnly Postgres tests pass on Npgsql 9.0.2 and fail on 10.0.2, which arrived with #174 - unseen because the Postgres integration tests need local Docker. As<DateTime[?]> now converts via ToDateTime(TimeOnly.MinValue), and As<TimeOnly[?]> answers default for a date - the same answer a zero-time DateTime gives, which is the contract the integration test documents. New docker-free unit tests cover the matrix directly, so this coverage no longer depends on a live container. Fixes#202
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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#202.
Npgsql 10 changed
reader.GetValue()for adatecolumn to returnDateOnlyrather thanDateTime;DateOnlydoesn't implementIConvertible, soAs<DateTime[?]>'s fallback throughConvert.ToDateTimethrewInvalidCastException. Bisected empirically: the DateOnlyTimeOnly Postgres tests pass on Npgsql 9.0.2 and fail on 10.0.2 (which arrived with #174) — unseen until now because the Postgres integration tests need local Docker.As<DateTime[?]>from aDateOnlyconverts viaToDateTime(TimeOnly.MinValue)As<TimeOnly[?]>from aDateOnlyanswers default — the same answer a zero-timeDateTimegives, which is the contract the integration test already documentsWith this, the full unit suite is green on all three TFMs locally (Docker up): 466/466 net10, 466/466 net8, 458/458 net48.