tidb icon indicating copy to clipboard operation
tidb copied to clipboard

Behavior of UTC_DATE() is different from mysql

Open tshqin opened this issue 9 years ago • 2 comments

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error.
select UTC_DATE();
select UTC_DATE() + 2;
  1. What did you expect to see?
mysql> select UTC_DATE();
+------------+
| UTC_DATE() |
+------------+
| 2017-08-22 |
+------------+
1 row in set (0.00 sec)

mysql> select UTC_DATE() + 2;
+----------------+
| UTC_DATE() + 2 |
+----------------+
|       20170824 |
+----------------+
1 row in set (0.00 sec)
  1. What did you see instead?
MySQL [(none)]> select UTC_DATE();
+------------+
| UTC_DATE() |
+------------+
| 2017-08-22 |
+------------+
1 row in set (0.00 sec)

MySQL [(none)]> select UTC_DATE() + 2;
+----------------+
| UTC_DATE() + 2 |
+----------------+
|           2019 |
+----------------+
1 row in set, 1 warning (0.00 sec)

  1. What version of TiDB are you using (tidb-server -V)? Git Commit Hash: 365e4ab491b683a69c2004f30b1ae4f86256e2ad Git Commit Branch: master UTC Build Time: 2017-08-16 01:24:27

tshqin avatar Aug 22 '17 15:08 tshqin

@tshqin Thanks! @tiancaiamao @XuHuaiyu PTAL

shenli avatar Aug 22 '17 15:08 shenli

fixed after rewriting function UTC_DATE() in this pr #4206

zz-jason avatar Aug 22 '17 16:08 zz-jason