Closed kamyker closed 2 years ago
PostgREST is able to use -/+Infinity
with no problem:
curl localhost:3000/articleStars?createdAt=gte.+Infinity
[]
curl localhost:3000/articleStars?createdAt=gte.-Infinity
[{"articleId":1,"userId":1,"createdAt":"2015-12-08T04:22:57.472738"},
{"articleId":1,"userId":2,"createdAt":"2015-12-08T04:22:57.472738"},
{"articleId":2,"userId":3,"createdAt":"2015-12-08T04:22:57.472738"},
{"articleId":3,"userId":2,"createdAt":"2015-12-08T04:22:57.472738"},
{"articleId":1,"userId":3,"createdAt":"2015-12-08T04:22:57.472738"}]
(More special values documented in: https://postgrest.org/en/latest/how-tos/working-with-postgresql-data-types.html)
So I guess this must be an issue with postgrest-csharp
itself.
@steve-chavez thanks for the reply! Wasn't aware of being able to use -/+Infinity
like that - good to know!
@kamyker to clarify, you have a record in the database with Datetime
as its type and a value of -infinity
and you are attempting to deserialize into a C# model that has DateTime
as its type as well?
Since we have to return a DateTime
, would it be alright if those were coerced into DateTime.MinValue
and DateTime.MaxValue
for -/+Infinity respectively?
@steve-chavez thanks for the reply! Wasn't aware of being able to use
-/+Infinity
like that - good to know!@kamyker to clarify, you have a record in the database with
Datetime
as its type and a value of-infinity
and you are attempting to deserialize into a C# model that hasDateTime
as its type as well?
Yes, exactly.
Since we have to return a
DateTime
, would it be alright if those were coerced intoDateTime.MinValue
andDateTime.MaxValue
for -/+Infinity respectively?
Yes the same way as npgsql does.
Inifinity is insterted when using npgsql https://www.npgsql.org/doc/types/datetime.html , then postgrest fails to desterilize it