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

wrong result for query containing timestamp type #10302

Closed
eurekaka opened this issue Apr 29, 2019 · 0 comments · Fixed by #10303
Closed

wrong result for query containing timestamp type #10302

eurekaka opened this issue Apr 29, 2019 · 0 comments · Fixed by #10303
Assignees
Labels
component/expression type/bug The issue is confirmed as a bug.

Comments

@eurekaka
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
mysql> create table t(a int primary key, b timestamp);
Query OK, 0 rows affected (0.01 sec)

mysql> insert into t values(1, '2019-04-29 12:38:15');
Query OK, 1 row affected (0.00 sec)

mysql> select * from t where b = '2019-04-29 12:38:15';
+---+---------------------+
| a | b                   |
+---+---------------------+
| 1 | 2019-04-29 12:38:15 |
+---+---------------------+
1 row in set (0.00 sec)

mysql> select * from t where b = (select max(b) from t);
Empty set (0.00 sec)

mysql> explain select * from t where b = (select max(b) from t);
+----------------------+-------+------+------------------------------------------------------------+
| id                   | count | task | operator info                                              |
+----------------------+-------+------+------------------------------------------------------------+
| TableReader_43       | 0.00  | root | data:Selection_42                                          |
| └─Selection_42       | 0.00  | cop  | eq(test.t.b, 2019-04-29 12:38:15)                          |
|   └─TableScan_41     | 1.00  | cop  | table:t, range:[-inf,+inf], keep order:false, stats:pseudo |
+----------------------+-------+------+------------------------------------------------------------+
3 rows in set (0.00 sec)
  1. What did you expect to see?

Both select queries should return one row.

  1. What did you see instead?

Second select query returns empty result set.

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
Release Version: v3.0.0-beta.1-160-gb5890b3cf
Git Commit Hash: b5890b3cf44eaf4faa48aa8478df9ce9506926ff
Git Branch: master
UTC Build Time: 2019-04-29 04:37:16
GoVersion: go version go1.12 darwin/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant