Bug #104653 extract result incorrect

Submitted: 18 Aug 2021 10:11 Modified: 18 Aug 2021 10:23
Reporter: track ay Email Updates:
Status: Documenting 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
[28 May 1:10] MySQL Admin
Posted by developer: Bug status updated to 'Documenting'

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.