summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Krivonos <sergei.krivonos@mariadb.com>2021-12-09 11:05:14 +0200
committerSergei Krivonos <sergeikrivonos@gmail.com>2021-12-10 22:12:01 +0200
commitea9489536911b083c5e28b15c071cf6931247b7e (patch)
treeca0dcd5fde117efbe8f472d99e52999978e26cc2
parentccdf5711a8fff0cd610a91fdcf37c8ff1182878c (diff)
downloadmariadb-git-ea9489536911b083c5e28b15c071cf6931247b7e.tar.gz
MDEV-27206: [ERROR] Duplicated key: cause, Assertion `is_uniq_key' failed with optimizer trace
-rw-r--r--mysql-test/main/explain_json.result13
-rw-r--r--mysql-test/main/explain_json.test14
-rw-r--r--sql/sql_select.cc2
3 files changed, 28 insertions, 1 deletions
diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result
index 810ececc65c..a107fa3a6ff 100644
--- a/mysql-test/main/explain_json.result
+++ b/mysql-test/main/explain_json.result
@@ -2000,3 +2000,16 @@ EXPLAIN
}
}
DROP TABLE t1;
+#
+# MDEV-27206: [ERROR] Duplicated key: cause, Assertion `is_uniq_key' failed with optimizer trace
+#
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (pk TIME, b INT, primary key (pk), key (b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+('00:13:33',0),('00:13:34',1),('00:13:35',2),('00:13:36',3),
+('00:13:37',4),('00:13:38',5),('00:13:39',6),('00:13:40',7),
+('00:13:41',8),('00:13:42',9);
+SET optimizer_trace = 'enabled=on';
+SELECT * FROM t1 WHERE a IN ( SELECT b FROM t2 INNER JOIN t1 ON (a = pk) );
+a
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/explain_json.test b/mysql-test/main/explain_json.test
index 3767939d3e3..07e4ec09ad4 100644
--- a/mysql-test/main/explain_json.test
+++ b/mysql-test/main/explain_json.test
@@ -429,3 +429,17 @@ explain FORMAT=JSON
SELECT * FROM t1 t0
WHERE t0.a IN (SELECT t2.a FROM t1 t2 WHERE t0.a IN (SELECT t3.a FROM t1 t3));
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-27206: [ERROR] Duplicated key: cause, Assertion `is_uniq_key' failed with optimizer trace
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (pk TIME, b INT, primary key (pk), key (b)) ENGINE=MyISAM;
+INSERT INTO t2 VALUES
+ ('00:13:33',0),('00:13:34',1),('00:13:35',2),('00:13:36',3),
+ ('00:13:37',4),('00:13:38',5),('00:13:39',6),('00:13:40',7),
+ ('00:13:41',8),('00:13:42',9);
+SET optimizer_trace = 'enabled=on';
+SELECT * FROM t1 WHERE a IN ( SELECT b FROM t2 INNER JOIN t1 ON (a = pk) );
+DROP TABLE t1, t2; \ No newline at end of file
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b08f2dd2545..c61ce06a8fb 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -7891,7 +7891,7 @@ best_access_path(JOIN *join,
/* quick_range couldn't use key! */
records= (double) s->records/rec;
trace_access_idx.add("used_range_estimates", false)
- .add("cause", "not available");
+ .add("reason", "not available");
}
}
else