I create a table:
Now I run this query:
The result is wrong. It should return only one row the maxumum value, which is '120:00:00'.
The same problem happens with this query:
It should return only one row with the minumum value, which is '-220:00:00'.
The problem happens because select_max_min_finder_subselect::cmp_str() is executed at some point during these queries. It compares values as strings, therefore:
- '120:00:00' is erroneously compared as less than '20:00:00'
- '-220:00:00' is erroneously compared as greater than '-120:00:00'
The TIME data type needs its own implementation, e.g. select_max_min_finder_subselect::cmp_time().