There is a difference in how COALESCE and GREATEST
passed to a function requiring a valid date process their
1. COALESCE recursively requires valid dates from its arguments:
Notice, it ignored the first argument and reported a warning for it,
then chose the second argument.
2. GREATEST does not require validity from its arguments:
Notice, it did not require validity from the first argument and did warn
not warn about it, and returned the second argument.
If GREATEST worked in the similar way with COALESCE,
the result for the entire query would be NULL, because
get_date('2010-00-01', NO_ZERO_IN_DATE) would return NULL.
This difference should be discussed,
and the other functions should be checked
Another example when COALESCE and GREATEST/LEAST return different results:
Notice difference in:
- Length: 12 vs 23
- Collation: utf8_general_ci vs binary
- Flags: BINARY in least only
- Returned result: '1.0' vs '1'