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 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.

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

@BrianLiu955 BrianLiu955 added the type/bug The issue is confirmed as a bug. label Jun 3, 2024
@Rustin170506 Rustin170506 added sig/execution SIG execution sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Jun 3, 2024
@Defined2014 Defined2014 added 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. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 labels Jun 4, 2024
@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 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants