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

add index on timestamp column causes index-lookup to fail #3485

Closed
darren opened this issue Jun 15, 2017 · 1 comment
Closed

add index on timestamp column causes index-lookup to fail #3485

darren opened this issue Jun 15, 2017 · 1 comment

Comments

@darren
Copy link
Contributor

darren commented Jun 15, 2017

  1. What did you do?
use test;
drop table if exists t1;
CREATE TABLE `t1` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
   PRIMARY KEY (`id`)
);

INSERT INTO `t1` VALUES (123381351,"2014-03-31 08:57:10");
select * from t1 where datetime='2014-03-31 08:57:10';
alter table t1 add key i_datetime (datetime);
select * from t1 where datetime='2014-03-31 08:57:10';
select * from t1;
  1. What did you expect to see?

select * from t1 where datetime='2014-03-31 08:57:10'; should return result after adding index on datetime

  1. What did you see instead?
mysql> select * from t1 where datetime='2014-03-31 08:57:10';
Empty set (0.00 sec)

mysql> select * from t1;
+-----------+---------------------+
| id        | datetime            |
+-----------+---------------------+
| 123381351 | 2014-03-31 08:57:10 |
+-----------+---------------------+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V)?

Git Commit Hash: fad6633
UTC Build Time: 2017-06-15 06:43:00

it is reproducible with patch in pr #3478, so it seems not related to issue #3467, so I opened a new one

@shenli
Copy link
Member

shenli commented Jun 15, 2017

@darren Thanks!
@tiancaiamao PTAL

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

No branches or pull requests

2 participants