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

When executing the DATE_FORMAT function, TiDB returns unexpected results #52937

Open
sjyango opened this issue Apr 27, 2024 · 3 comments
Open

Comments

@sjyango
Copy link

sjyango commented Apr 27, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t0 (
  c0 double NOT NULL,
  UNIQUE (c0)
);

INSERT INTO t0 VALUES (0), (0.06771666817351274), (748334112), (1747356538);

SELECT t0.c0 FROM t0 GROUP BY t0.c0 HAVING DATE_FORMAT(t0.c0, t0.c0) IS NULL;

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

+------------+
| c0         |
+------------+
|  748334112 |
| 1747356538 |
+------------+

3. What did you see instead (Required)

MySQL> SELECT t0.c0 FROM t0 GROUP BY t0.c0 HAVING DATE_FORMAT(t0.c0, t0.c0) IS NULL;
+---------------------+
| c0                  |
+---------------------+
| 0.06771666817351274 |
|           748334112 |
|          1747356538 |
|                   0 |
+---------------------+
4 rows in set, 7 warnings (0.003 sec)

4. What is your TiDB version? (Required)

MySQL> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                               |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.0.0
Edition: Community
Git Commit Hash: 8ba1fa452b1ccdbfb85879ea94b9254aabba2916
Git Branch: HEAD
UTC Build Time: 2024-03-28 14:22:04
GoVersion: go1.21.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.002 sec)
@yibin87
Copy link
Contributor

yibin87 commented Apr 28, 2024

Unrealistic case, lower to moderate.

@yibin87
Copy link
Contributor

yibin87 commented Apr 28, 2024

/remove-severity critical

@yibin87
Copy link
Contributor

yibin87 commented Apr 28, 2024

/severity moderate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants