MDEV-17351 made functions ADDTIME(t,time_interval) and TIMESTAMP(t,time_interval) understand long time intervals in the second argument.
This task is to make EXTRACT(x AS *) understand long time intervals as well, for consistency.
We'll change EXTRACT(x AS *) to parse some input formats as time interval, instead of DATE or TIME.
Note, this change will affect only units starting with DAY*, HOUR*, MINUTE*, SECOND*, MICROSECOND*.
Behavior of extraction units starting with YEAR* and MONTH* will not change.
Examples of literal that will be parsed as time interval rather than DATE or TIME:
- '20 10:20:30'
- '2024:01:03 garbage /////'
- '24:01:03 garbage /////'
- '01:01:03 garbage /////'
For example, in this script:
the new EXTRACT() will return these results:
Note, the current behavior returns this result:
Note, behavior of these functions won't change:
They are MySQL compatibility functions and return different results comparing to the corresponding EXTRACT(unit FROM x). We won't touch them in this MDEV.