Bug #104653 extract result incorrect
Submitted: 18 Aug 2021 10:11 Modified: 18 Aug 2021 10:23
Reporter: track ay Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.0.26, 5.7.35 OS:Any
Assigned to: CPU Architecture:Any

[18 Aug 2021 10:11] track ay
Description:
mysql> select extract(minute_microsecond from '2018-02-01');

+-----------------------------------------------+
| extract(minute_microsecond from '2018-02-01') |
+-----------------------------------------------+
|                                    2018000000 |
+-----------------------------------------------+
1 row in set, 1 warning (0.03 sec)

How to repeat:
select extract(minute_microsecond from '2018-02-01');

Suggested fix:
I don't think this result is reasonable, but I'm not sure what the correct result is. Mabey it should return the same result with the following sqls.

mysql> select extract(minute_microsecond from cast('2018-02-01' as datetime));

+-----------------------------------------------------------------+
| extract(minute_microsecond from cast('2018-02-01' as datetime)) |
+-----------------------------------------------------------------+
|                                                               0 |
+-----------------------------------------------------------------+
1 row in set (0.04 sec)

mysql> select extract(minute_microsecond from cast('2018-02-01' as date));

+-------------------------------------------------------------+
| extract(minute_microsecond from cast('2018-02-01' as date)) |
+-------------------------------------------------------------+
|                                                           0 |
+-------------------------------------------------------------+
1 row in set (0.06 sec)
[18 Aug 2021 10:23] MySQL Verification Team
Hello track ay,

Thank you for the report and test case.
Verified as described.

regards,
Umesh