summaryrefslogtreecommitdiff
path: root/mysql-test/r/key.result
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-05-06 04:40:45 +0300
committerunknown <monty@mysql.com>2004-05-06 04:40:45 +0300
commitd91477ced61be70f496e4188f21ecb8114c72c26 (patch)
tree80f76507b006a150b010103690cf00076522d53b /mysql-test/r/key.result
parent1f32e9a19985554a0e79f16b349f7afcc0dbbe57 (diff)
downloadmariadb-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/r/key.result')
-rw-r--r--mysql-test/r/key.result13
1 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index b8387389075..28824de94ce 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -222,3 +222,16 @@ explain select 1 from t1 where id =2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref id id 4 const 1 Using where; Using index
drop table t1;
+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';
+numeropost
+1
+EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const numreponse numreponse 4 const 1 Using index
+FLUSH TABLES;
+SELECT numeropost FROM t1 WHERE numreponse='1';
+numeropost
+1
+drop table t1;