Most/all relational database support GREATEST/LEAST, which accept an arbitrary number of parameters and return the greatest one. Note that unlike MAX/MIN, these aren't aggregate functions - they're just regular, non-aggregate variadic functions.
We can add EF.Functions.{Greatest,Least} in relational to support these. Note that these would be similar to Math.Max and Min, which we should also translate; however, a custom EF.Functions.Greatest would provide the following advantages:
- Support types for which Math.Max overloads don't exist (DateTime, string...)
- Allow passing more than 2 arguments without nesting Math.Max calls, since these aren't variadic and support only two arguments.
Originally requested e.g. in npgsql/efcore.pg#2866
Most/all relational database support GREATEST/LEAST, which accept an arbitrary number of parameters and return the greatest one. Note that unlike MAX/MIN, these aren't aggregate functions - they're just regular, non-aggregate variadic functions.
We can add
EF.Functions.{Greatest,Least}in relational to support these. Note that these would be similar to Math.Max and Min, which we should also translate; however, a custom EF.Functions.Greatest would provide the following advantages:Originally requested e.g. in npgsql/efcore.pg#2866