-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
dateAdd function bug #27573
Comments
The returning type is wrong. |
more cases, seems not only the type problem mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = 20201210;
Empty set (0.05 sec)
mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = cast(20201210 as char);
+-------+
| a |
+-------+
| 20129 |
+-------+
1 row in set (0.05 sec)
mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = cast(20201210 as date);
+-------+
| a |
+-------+
| 20129 |
+-------+
1 row in set (0.04 sec)
mysql> select DATE_ADD('20129', INTERVAL 1 day ) = 20201210;
+------------------------------------------------+
| DATE_ADD('20129', INTERVAL 1 day ) = 20201210 |
+------------------------------------------------+
| 0 |
+------------------------------------------------+
1 row in set (0.04 sec)
mysql> select DATE_ADD('201209', INTERVAL 1 day ) = 20201210;
+-------------------------------------------------+
| DATE_ADD('201209', INTERVAL 1 day ) = 20201210 |
+-------------------------------------------------+
| 1 |
+-------------------------------------------------+
1 row in set (0.04 sec)
mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = '20201210';
+-------+
| a |
+-------+
| 20129 |
+-------+
1 row in set (0.05 sec)
mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = '2020-12-10';
+-------+
| a |
+-------+
| 20129 |
+-------+
1 row in set (0.05 sec)
mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = cast('2020-12-10' as date);
+-------+
| a |
+-------+
| 20129 |
+-------+
1 row in set (0.04 sec)
mysql> select * from t where DATE_ADD(a, INTERVAL 1 day ) = cast('20201210' as date);
+-------+
| a |
+-------+
| 20129 |
+-------+
1 row in set (0.04 sec) |
degrade to major because most common usages was correct |
Please check whether the issue should be labeled with 'affects-x.y' or 'fixes-x.y.z', and then remove 'needs-more-info' label. |
* topsql: make topsql enable only be controlled by pub/sub sink (pingcap#31209) * ddl: support batch create table (pingcap#28763) * executor: fix data race in IndexMergeReaderExec (pingcap#31230) close pingcap#31229 * server: filter the EOF error for normal closed at handshake (pingcap#31081) close pingcap#31063 * expression: change date add function return type (pingcap#28133) close pingcap#27573 * support create interval partition Signed-off-by: crazycs520 <crazycs520@gmail.com> * support create interval partition (support int/timestamp partition key) Signed-off-by: crazycs520 <crazycs520@gmail.com> * parser: support alter table partitions move engine statement Signed-off-by: crazycs520 <crazycs520@gmail.com> * support ddl operation Signed-off-by: crazycs520 <crazycs520@gmail.com> * support interval partition manager Signed-off-by: crazycs520 <crazycs520@gmail.com> * support interval partition manager handle job framwork Signed-off-by: crazycs520 <crazycs520@gmail.com> * support auto create interval partition when insert meet no partition suitable error Signed-off-by: crazycs520 <crazycs520@gmail.com> * fix bug Signed-off-by: crazycs520 <crazycs520@gmail.com> * fix cancel job and load old job then continue to do Signed-off-by: crazycs520 <crazycs520@gmail.com> * make partition readonly work(not allow to insert/update/delete) Signed-off-by: crazycs520 <crazycs520@gmail.com> * add begin,end time in tables Signed-off-by: crazycs520 <crazycs520@gmail.com> * tiny fix for auto create interval partition in concurrent case Signed-off-by: crazycs520 <crazycs520@gmail.com> * init Signed-off-by: crazycs520 <crazycs520@gmail.com> * init Signed-off-by: crazycs520 <crazycs520@gmail.com> * todo: remove flag Signed-off-by: crazycs520 <crazycs520@gmail.com> * fix dumpling Signed-off-by: crazycs520 <crazycs520@gmail.com> * remove data in aws s3 when drop/truncate table/partition Signed-off-by: crazycs520 <crazycs520@gmail.com> * make hello world work Signed-off-by: crazycs520 <crazycs520@gmail.com> * remove debug info Signed-off-by: crazycs520 <crazycs520@gmail.com> Co-authored-by: xhe <xw897002528@gmail.com> Co-authored-by: guo-shaoge <shaoge1994@163.com> Co-authored-by: knull-cn <hu__haifeng@163.com> Co-authored-by: Meng Xin <tregoldmeng@gmail.com>
Bug Report
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
v5.1.1
The text was updated successfully, but these errors were encountered: