Skip to content

wrong result of timestampadd(month,1,date '2024-01-31') #41052

@crazycs520

Description

@crazycs520

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

The issue if from https://ask.pingcap.com/t/timestampadd-function/419.

select timestampadd(month,1,date '2024-01-31');

2. What did you expect to see? (Required)

MySQL result is expected, as following:

> select timestampadd(month,1,date '2024-01-31');
+-----------------------------------------+
| timestampadd(month,1,date '2024-01-31') |
+-----------------------------------------+
| 2024-02-29                              |
+-----------------------------------------+

3. What did you see instead (Required)

> select timestampadd(month,1,date '2024-01-31');
+-----------------------------------------+
| timestampadd(month,1,date '2024-01-31') |
+-----------------------------------------+
| 2024-03-02                              |
+-----------------------------------------+

4. What is your TiDB version? (Required)

***************************[ 1. row ]***************************
tidb_version() | Release Version: v6.6.0-alpha-346-gd0d321f440
Edition: Community
Git Commit Hash: d0d321f440e265e6eb87731ba9fbf3611bf0dca2
Git Branch: master
UTC Build Time: 2023-02-04 00:17:06
GoVersion: go1.19.3
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-6.6affects-7.0affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.severity/majorsig/executionSIG executiontype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions