Open SchweinchenFuntik opened 2 years ago
Dates in generated SQL are represented as String
s in ISO format. DBMSs automatically convert them to respectful (date
/datetime
/timestamp
) type during query execution. But LocalDate.MAX.withDayOfMonth(1)
is bigger than the upper limit of date
type value in PostgreSQL and other DBMS. And while PostgreSQL is issuing a PSQLException
in this case, other DBMSs seem to convert it with overflow, resulting in always false condition.
So, basically, it's a DBMS limitation. How could ORM mitigate it?
probably not much. Millet behavior of ORM and raw SQL is different. The first gives an empty result, and the second - data.
At the same time, raw SQL was taken from the Exposed log
if you use
LocalDate.MAX
then the h2 database query is executed only in the raw query, and the Exposed query does not work. posgres - errorLOG: H2
LOG: PG if
to = LocalDate.MAX.withDayOfMonth(1)
if you use
Postgres.maxTimestamp
then all queries are successful