summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_bug878769.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-10-22 07:19:43 -0700
committerIgor Babaev <igor@askmonty.org>2011-10-22 07:19:43 -0700
commit2b173bf894b99e7ad5a4e499459141ca08c5027d (patch)
treebc02dccdc8cf9bf95f154ab2d30c3bb9756dc5f6 /mysql-test/t/innodb_bug878769.test
parentfdf789a7eadf864ecc0e617f25f795fafda55026 (diff)
downloadmariadb-git-2b173bf894b99e7ad5a4e499459141ca08c5027d.tar.gz
Fixed LP bug #878769.
The method DsMrr_impl::dsmrr_init erroneously tried to get a KEY descriptor for key with number MAX_KEY. This caused valgrind complains.
Diffstat (limited to 'mysql-test/t/innodb_bug878769.test')
-rw-r--r--mysql-test/t/innodb_bug878769.test56
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_bug878769.test b/mysql-test/t/innodb_bug878769.test
new file mode 100644
index 00000000000..157c7827dde
--- /dev/null
+++ b/mysql-test/t/innodb_bug878769.test
@@ -0,0 +1,56 @@
+--source include/have_innodb.inc
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+--echo #
+--echo # Bug #878769: valgrind complains when using join cache
+--echo # to join an InnoDB table without primary key
+--echo #
+
+CREATE TABLE t1 (
+ col_int_key int(11), col_time_key time, col_varchar_key varchar(1),
+ KEY (col_int_key), KEY (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT IGNORE INTO t1 VALUES
+ (7,'10:19:31','d'),(1,'14:40:36','r'),(7,'04:37:47','f'),(9,'19:34:06','y'),
+ (2,'00:00:00','m'),(4,'00:13:25','q'),(0,'03:47:16',NULL),(4,'01:41:48','d'),
+ (8,'00:00:00','g'),(NULL,'22:32:04','x'),(NULL,'16:44:14','f'),
+ (0,'17:38:37','p'),(NULL,'08:46:48','j'),(8,'14:11:27','c');
+
+CREATE TABLE t2 (
+ col_int_nokey int(11), col_int_key int(11),
+ col_datetime_key datetime, col_datetime_nokey datetime,
+ col_varchar_key varchar(1), col_varchar_nokey varchar(1),
+ KEY (col_int_key), KEY (col_varchar_key,col_int_key)
+);
+INSERT IGNORE INTO t2 VALUES
+ (150,62,'2008-01-03 10:33:32','2008-01-03 10:33:32','v','v'),
+ (2,1,'2007-10-09 19:53:04','2007-10-09 19:53:04',NULL,NULL),
+ (5,0,'2001-11-08 21:02:12','2001-11-08 21:02:12','x','x'),
+ (3,7,'2003-04-01 00:00','2003-04-01 00:00','i','i'),
+ (1,7,'1900-01-01 00:00','1900-01-01 00:00:00','e','e'),
+ (NULL,7,'2005-04-04 01:21','2005-04-04 01:21','s','s'),
+ (2,1,'1900-01-01 00:00','1900-01-01 00:00','j','j'),
+ (8,0,'2004-04-28 21:44','2004-04-28 21:44','a','a'),
+ (6,8,'2001-04-18 00:00','2001-04-18 00:00:00','y','y'),
+ (8,1,'2008-12-18 19:39:55','2008-12-18 19:39:55',NULL,NULL),
+ (3,1,'2000-08-01 12:19:39','2000-08-01 12:19:39','r','r'),
+ (3,9,'2004-09-25 21:29:06','2004-09-25 21:29:06','v','v');
+
+set session optimizer_switch='mrr=on,mrr_sort_keys=on';
+set session join_cache_level=6;
+
+EXPLAIN
+SELECT t1.col_time_key, t1.col_varchar_key
+ FROM t2 STRAIGHT_JOIN t1 ON t1.col_int_key = t2.col_int_key
+GROUP BY 1,2;
+SELECT t1.col_time_key, t1.col_varchar_key
+ FROM t2 STRAIGHT_JOIN t1 ON t1.col_int_key = t2.col_int_key
+GROUP BY 1,2;
+
+set session optimizer_switch=default;
+set session join_cache_level=default;
+
+DROP TABLE t1,t2;