Timestampadd function

Application environment:

test was run in docker.io/pingcap/tidb:v5.1.4


I noticed that the timestampadd function appears to return a different result in tidb as compared to mysql, e.g.
select timestampadd(month,1,date '2024-01-31') in MySQL will return ‘2024-02-29’ , whereas in
tidb (docker version) it returns ‘2024-03-02’, which I believe is not correct
Is this a known issue and, if so, is there a workaround?


Nice catch, look like it is a bug.

I already create a bug issue for this: issue#41052: wrong result of timestampadd(month,1,date ‘2024-01-31’)


Hi, Jan, Seems like it was a bug of MySQL, You can refer to this reply wrong result of timestampadd(month,1,date '2024-01-31') · Issue #41052 · pingcap/tidb · GitHub.

We already reported a bug to MySQL https://bugs.mysql.com/bug.php?id=109941, and have been verified as a bug by MySQL Verification Team. Thanks, please stay tuned.

Hi, thanks for your feedback.
We’ll fix this problem in TiDB.