Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result of function QUARTER/DATE_FORMAT is different from MySQL. #11203

Closed
SunRunAway opened this issue Jul 11, 2019 · 4 comments
Closed

Result of function QUARTER/DATE_FORMAT is different from MySQL. #11203

SunRunAway opened this issue Jul 11, 2019 · 4 comments
Labels
component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/bug The issue is confirmed as a bug. type/compatibility

Comments

@SunRunAway
Copy link
Contributor

SunRunAway commented Jul 11, 2019

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
select QUARTER( 0 ), QUARTER( 0.0 );
  1. What did you expect to see?
mysql> select QUARTER( 0 ), QUARTER( 0.0 );
+--------------+----------------+
| QUARTER( 0 ) | QUARTER( 0.0 ) |
+--------------+----------------+
|            0 |              0 |
+--------------+----------------+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> select QUARTER( 0 ), QUARTER( 0.0 );
+--------------+----------------+
| QUARTER( 0 ) | QUARTER( 0.0 ) |
+--------------+----------------+
|         NULL |           NULL |
+--------------+----------------+
1 row in set, 2 warnings (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '0000-00-00 00:00:00.000000' |
| Warning | 1292 | invalid time format: '0.0'                             |
+---------+------+--------------------------------------------------------+
2 rows in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    8c20289
@SunRunAway SunRunAway added type/bug The issue is confirmed as a bug. type/compatibility labels Jul 11, 2019
@SunRunAway
Copy link
Contributor Author

SunRunAway commented Jul 11, 2019

Function DATE_FORMAT meets the same problem.

In MySQL:

mysql> select DATE_FORMAT(0, 0);
+-------------------+
| DATE_FORMAT(0, 0) |
+-------------------+
| 0                 |
+-------------------+
1 row in set (0.00 sec)

In TiDB:

mysql> select DATE_FORMAT(0, 0);
+-------------------+
| DATE_FORMAT(0, 0) |
+-------------------+
| NULL              |
+-------------------+
1 row in set, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------+
| Level   | Code | Message                                                |
+---------+------+--------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '0000-00-00 00:00:00.000000' |
+---------+------+--------------------------------------------------------+
1 row in set (0.00 sec)

@SunRunAway SunRunAway changed the title Result of function QUARTER is different from MySQL. Result of function QUARTER/DATE_FORMAT is different from MySQL. Jul 11, 2019
@SunRunAway SunRunAway added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Jul 12, 2019
@tiancaiamao
Copy link
Contributor

@SunRunAway Would you like to solve it?

@SunRunAway
Copy link
Contributor Author

@tiancaiamao #12488 is on going

@ekalinin
Copy link
Contributor

ekalinin commented Nov 9, 2019

The issue could be closed now. Related PR just was merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/bug The issue is confirmed as a bug. type/compatibility
Projects
None yet
Development

No branches or pull requests

3 participants