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
I'm working on the breakdance-net5, with the latest postgres provider.
Npgsql 6.0 has a breaking change around timestamp mapping which breaks querying via OData. In order to query a Postgres column of type 'timestamp with time zone', the corresponding DateTime needs to have Kind = DateTimeKind.Utc.
However, all dates in the $filter clause are parsed with DateTimeKind.Unspecified, which causes Npgsql to throw an exception and results in OData returning an invalid and incomplete JSON response.
Actual Result
write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
The text was updated successfully, but these errors were encountered:
It seems like this might have been an issue with the core OData libraries. I apologize for not seeing this issue sooner... were you able to work it out?
I'm working on the breakdance-net5, with the latest postgres provider.
Npgsql 6.0 has a breaking change around timestamp mapping which breaks querying via OData. In order to query a Postgres column of type 'timestamp with time zone', the corresponding DateTime needs to have Kind = DateTimeKind.Utc.
However, all dates in the $filter clause are parsed with DateTimeKind.Unspecified, which causes Npgsql to throw an exception and results in OData returning an invalid and incomplete JSON response.
Setting builder.Select().Expand().Filter().OrderBy().MaxTop(100).Count().SetTimeZoneInfo(TimeZoneInfo.Utc);
Assemblies affected
This behavior is observed using the latest bits in the branch titled "breakdance-net5"
Reproduce steps
Uses a postgres data base with the latest npgsql provider and try to filter an entity by date and time
https://localhost:44307/v_errorlog?$orderby=datetimeinlocaltime desc&$top=10&$filter=(datetimeinlocaltime ge 2022-03-10T16:43:00Z) and (datetimeinlocaltime lt 2022-03-10T16:44:00Z)&$count=true
Actual Result
write DateTime with Kind=Unspecified to PostgreSQL type 'timestamp with time zone', only UTC is supported. Note that it's not possible to mix DateTimes with different Kinds in an array/range. See the Npgsql.EnableLegacyTimestampBehavior AppContext switch to enable legacy behavior.
The text was updated successfully, but these errors were encountered: