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

The query is inconsistent with MySQL when using the default value of the current_date() column in the function #53746

Closed
BrianLiu955 opened this issue Jun 3, 2024 · 2 comments · Fixed by #54045
Assignees
Labels
affects-7.1 affects-7.5 affects-8.1 component/ddl This issue is related to DDL of TiDB. report/customer Customers have encountered this bug. severity/major type/bug The issue is confirmed as a bug.

Comments

@BrianLiu955
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

#In TiDB
#table creation
mysql> show create table rand;
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
| rand | CREATE TABLE rand (
id int(11) DEFAULT NULL,
date_t date DEFAULT CURRENT_DATE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> insert into rand(id) values(1);
Query OK, 1 row affected (0.01 sec)

mysql> insert into rand values(1,'2024-06-03 00:00:00.000000');
Query OK, 1 row affected (0.01 sec)

mysql> select * from rand;
+------+------------+
| id | date_t |
+------+------------+
| 1 | 2024-06-03 |
| 1 | 2024-06-03 |
+------+------------+
2 rows in set (0.01 sec)

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

#Behavior in MySQL
root@localhost : test 02:15:59>>> select date_t ,count() from rand group by date_t;
+------------+----------+
| date_t | count(
) |
+------------+----------+
| 2024-06-03 | 2 |
+------------+----------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

#Behavior in TiDB
mysql> select date_t ,count() from rand group by date_t;
+------------+----------+
| date_t | count(
) |
+------------+----------+
| 2024-06-03 | 1 |
| 2024-06-03 | 1 |
+------------+----------+
2 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

v7.1.1

@Defined2014
Copy link
Contributor

@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.1 affects-7.5 affects-8.1 component/ddl This issue is related to DDL of TiDB. report/customer Customers have encountered this bug. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants