3791 Chaithra Gopalareddy 2012-04-18 [merge]
Merge from 5.1 to 5.5
@ mysql-test/r/select.result
Added test result for Bug#12713907
@ mysql-test/t/select.test
Added test case for Bug#12713907
@ sql/sql_select.cc
Remove the call to set_keyread as we do it from access
functions 'join_read_first' and 'join_read_last'
modified:
mysql-test/r/select.result
mysql-test/t/select.test
sql/sql_select.cc
3790 Annamalai Gurusami 2012-04-18
Bug #12902967 Creating self referencing fk on same index unhandled,
confusing error. I have added the not_embedded.inc in the test file.
modified:
mysql-test/suite/innodb/t/innodb_bug12902967.test
=== modified file 'mysql-test/r/select.result'
--- a/mysql-test/r/select.result 2011-12-15 11:18:40 +0000
+++ b/mysql-test/r/select.result 2012-04-18 06:04:36 +0000
@@ -4988,3 +4988,30 @@ f1
DROP TABLE t1;
DROP VIEW view_t1;
# End of test BUG#63020
+#
+# Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
+# COUNT(*) LIMIT.
+#
+CREATE TABLE t1 (
+id BIGINT(20) ,
+member_id_to INT(11) ,
+r_date DATE ,
+PRIMARY KEY (id,r_date),
+KEY r_date_idx (r_date),
+KEY t1_idx01 (member_id_to)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(107924526,518491,'2011-05-01'),
+(107924527,518491,'2011-05-01'),
+(107924534,518491,'2011-06-21'),
+(107924535,518491,'2011-06-21'),
+(107924542,1601319,'2011-06-21'),
+(107924543,1601319,'2011-06-21'),
+(107924544,1601319,'2011-06-21'),
+(107924545,1601319,'2011-06-21');
+SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
+'2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
+member_id_to COUNT(*)
+518491 2
+DROP TABLE t1;
+# End of test BUG#12713907
=== modified file 'mysql-test/t/select.test'
--- a/mysql-test/t/select.test 2011-12-15 11:18:40 +0000
+++ b/mysql-test/t/select.test 2012-04-18 06:04:36 +0000
@@ -4253,3 +4253,35 @@ DROP VIEW view_t1;
--echo # End of test BUG#63020
+
+--echo #
+--echo # Bug#12713907: STRANGE OPTIMIZE & WRONG RESULT UNDER ORDER BY
+--echo # COUNT(*) LIMIT.
+--echo #
+
+CREATE TABLE t1 (
+id BIGINT(20) ,
+member_id_to INT(11) ,
+r_date DATE ,
+PRIMARY KEY (id,r_date),
+KEY r_date_idx (r_date),
+KEY t1_idx01 (member_id_to)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(107924526,518491,'2011-05-01'),
+(107924527,518491,'2011-05-01'),
+(107924534,518491,'2011-06-21'),
+(107924535,518491,'2011-06-21'),
+(107924542,1601319,'2011-06-21'),
+(107924543,1601319,'2011-06-21'),
+(107924544,1601319,'2011-06-21'),
+(107924545,1601319,'2011-06-21');
+
+SELECT member_id_to, COUNT(*) FROM t1 WHERE r_date =
+ '2011-06-21' GROUP BY member_id_to ORDER BY 2 LIMIT 1;
+
+DROP TABLE t1;
+
+--echo # End of test BUG#12713907
+
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2012-02-17 09:57:45 +0000
+++ b/sql/sql_select.cc 2012-04-18 06:04:36 +0000
@@ -13925,8 +13925,6 @@ check_reverse_order:
join_read_first:join_read_last;
tab->type=JT_NEXT; // Read with index_first(), index_next()
- if (table->covering_keys.is_set(best_key))
- table->set_keyread(TRUE);
table->file->ha_index_or_rnd_end();
if (tab->join->select_options & SELECT_DESCRIBE)
{
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5 branch (chaithra.gopalareddy:3790 to 3791) | Chaithra Gopalareddy | 20 Apr |