diff options
author | unknown <monty@mysql.com> | 2004-05-06 04:40:45 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-06 04:40:45 +0300 |
commit | d91477ced61be70f496e4188f21ecb8114c72c26 (patch) | |
tree | 80f76507b006a150b010103690cf00076522d53b /mysql-test/t/key.test | |
parent | 1f32e9a19985554a0e79f16b349f7afcc0dbbe57 (diff) | |
download | mariadb-git-d91477ced61be70f496e4188f21ecb8114c72c26.tar.gz |
Fixed wrong key usage which caused wrong result for some "WHERE primary_key=constant" queries where MySQL could use 'only index' (Bug #3666)
The bug was introduced in a patch in the 4.1.2 source tree.
mysql-test/r/key.result:
New result
mysql-test/t/key.test:
Added test case for bug in key read
sql/sql_select.cc:
Fixed wrong key usage which caused wrong result for some "WHERE primary_key=constant" queries where MySQL could use 'only index' (Bug #3666)
Diffstat (limited to 'mysql-test/t/key.test')
-rw-r--r-- | mysql-test/t/key.test | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index 4fa85477318..8d399abfec9 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -216,3 +216,15 @@ explain select name from t1 where id =2; ALTER TABLE t1 DROP PRIMARY KEY, ADD INDEX (id); explain select 1 from t1 where id =2; drop table t1; + +# +# Test of problem with key read (Bug #3666) +# + +CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse)); +INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4'); +SELECT numeropost FROM t1 WHERE numreponse='1'; +EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1'; +FLUSH TABLES; +SELECT numeropost FROM t1 WHERE numreponse='1'; +drop table t1; |