The query is inconsistent with MySQL when using the default value of the current_date() column in the function #53746
Labels
affects-7.1
This bug affects the 7.1.x(LTS) versions.
affects-7.5
This bug affects the 7.5.x(LTS) versions.
affects-8.1
This bug affects the 8.1.x(LTS) versions.
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.
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
The text was updated successfully, but these errors were encountered: