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
Invariant culture is not used for DateTime in GenerateNonNullSqlLiteral #787
Microsoft (R) Roslyn C# Compiler version 2.10.0.0
Loading context from 'CSharpInteractive.rsp'.
Type "#help" for more information.
> $"TIMESTAMP '{(DateTime)(new DateTime(1, 1, 1, 1, 1, 1)):yyyy-MM-dd HH:mm:ss.FFFFFF}'"
"TIMESTAMP '0001-01-01 01.01.01'"
PS. @roji feel free to fix this issue as you see it is done best :)
@ljani Thanks for reporting this to us. It does appear that we need to use invariant culture formatting for date and time types.
Note that this does not impact the NodaTime plugin, because those type mappings use NodaTime-provided formatters which format with the invariant culture by default.
changed the title [-]Incorrect ALTER clause is generated with a DateTime as a default value with Finnish locale[/-][+]Invariant culture is not used for DateTime in GenerateNonNullSqlLiteral[/+]on Jan 8, 2019
Activity
ljani commentedon Jan 8, 2019
That is probably the issue, because
RelationalTypeMappingpassesCultureInfo.InvariantCulturetostring.FormatinGenerateNonNullSqlLiteralwhereas Npgsql does not do that.EDIT: Here's a repro:
PS. @roji feel free to fix this issue as you see it is done best :)
austindrenski commentedon Jan 8, 2019
@ljani Thanks for reporting this to us. It does appear that we need to use invariant culture formatting for date and time types.
Note that this does not impact the NodaTime plugin, because those type mappings use NodaTime-provided formatters which format with the invariant culture by default.
[-]Incorrect ALTER clause is generated with a DateTime as a default value with Finnish locale[/-][+]Invariant culture is not used for DateTime in GenerateNonNullSqlLiteral[/+]ljani commentedon Jan 9, 2019
@austindrenski Great, thanks for the speedy fix!