Pihentagy
03/12/2026, 10:41 AMPihentagy
03/12/2026, 10:42 AMLuis Arcos
03/12/2026, 11:39 AMPihentagy
03/12/2026, 11:42 AMPihentagy
03/12/2026, 12:05 PMLuis Arcos
03/12/2026, 1:29 PMChantal Loncle
03/12/2026, 2:51 PMNOT NULL, the function MIN() can still return SQL NULL in certain cases:
• When the table is empty
• When the WHERE cause filters out all rows
No rows == empty result set == null return. If Exposed min() didn't allow for this possibility by being nullable, it could be a problem in some cases.
So, just like with SQL, Exposed leaves it to users to handle this null possibility in whatever way they choose.
I personally prefer to handle it on the database side by wrapping min() (& other aggregates) in COALESCE, but that's just one option:
val minCost = Coalesce(measuredAt.min(), intLiteral(0))
// select coalesce(min(measured_at),0), ...Pihentagy
03/15/2026, 6:40 PMmin and max columns can indeed return null values, so one should check for them.