You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow writing DateTime.MinValue to timestamptz even though it's Unspecified #4032
In 6.0, we cleanly separated UTC DateTime from non-UTC DateTime, mapping the former to timestamptz and the latter to timestamp; trying to write a non-UTC timestamp to timestamptz now errors (#3947).
However, we may want to have an exception specifically for DateTime.MinValue/MaxValue, especially since DateTime.MinValue is also the default. For example, say you have an EF Core entity with a DateTime property:
classMyEntity{publicDateTimeTimestamp{get;set;}}
We now map DateTime to timestamptz by default, but default(DateTime) has Kind=Unspecified, so it's impossible to save this entity without first manually initializing the property to DateTime.SpecifyKind(default, DateTime.Utc). This is a problematic state of affairs.
Instead, we could specifically identify MinValue/MaxValue and send them as-is (without any conversions).
changed the title [-]Allow writing DateTime.Min/MaxValue to timestamptz even though they're unspecified[/-][+]Allow writing DateTime.Min to timestamptz even though they're unspecified[/+]on Oct 15, 2021
changed the title [-]Allow writing DateTime.Min to timestamptz even though they're unspecified[/-][+]Allow writing DateTime.Min to timestamptz even though it's unspecified[/+]on Oct 15, 2021
changed the title [-]Allow writing DateTime.Min to timestamptz even though it's unspecified[/-][+]Allow writing DateTime.Min to timestamptz even though it's Unspecified[/+]on Oct 15, 2021
changed the title [-]Allow writing DateTime.Min to timestamptz even though it's Unspecified[/-][+]Allow writing DateTime.MinValue to timestamptz even though it's Unspecified[/+]on Oct 15, 2021
Activity
NinoFloris commentedon Oct 10, 2021
That sounds good! Specifically supporting default(DateTime) seems fairly important.
Make timestamp infinity conversion the default
Make timestamp infinity conversion the default (#4035)
[-]Allow writing DateTime.Min/MaxValue to timestamptz even though they're unspecified[/-][+]Allow writing DateTime.Min to timestamptz even though they're unspecified[/+][-]Allow writing DateTime.Min to timestamptz even though they're unspecified[/-][+]Allow writing DateTime.Min to timestamptz even though it's unspecified[/+][-]Allow writing DateTime.Min to timestamptz even though it's unspecified[/-][+]Allow writing DateTime.Min to timestamptz even though it's Unspecified[/+][-]Allow writing DateTime.Min to timestamptz even though it's Unspecified[/-][+]Allow writing DateTime.MinValue to timestamptz even though it's Unspecified[/+]