[Commits] 2a3d3e052f6: MDEV-16721: Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT'
revision-id: 2a3d3e052f63cca4548c5bf8ef48040ecc39c5cf (mariadb-10.3.6-56-g2a3d3e052f6) parent(s): 998c97e865c4efecd36c57eccf3d900135a5709f author: Galina Shalygina committer: Galina Shalygina timestamp: 2018-07-27 19:00:53 +0200 message: MDEV-16721: Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT' failed The bug appeared as in MDEV-12387 setup_jtbm_semi_joins() procedure had been devided into two functions, one called before optimization of WHERE clause and another after this optimization. When the second function was called for a degenerated jtbm semi join equalities connecting the subselect and the parent select were created but invocation of fix_fields() for these equalities was missing. --- mysql-test/main/in_subq_cond_pushdown.result | 12 ++++++++++++ mysql-test/main/in_subq_cond_pushdown.test | 16 ++++++++++++++++ sql/opt_subselect.cc | 3 ++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result index a6246ec17d1..06b7de7a5ac 100644 --- a/mysql-test/main/in_subq_cond_pushdown.result +++ b/mysql-test/main/in_subq_cond_pushdown.result @@ -3802,3 +3802,15 @@ EXPLAIN } DROP TABLE t1,t2,t3; DROP VIEW v1,v2; +# +# MDEV-16721: IN-subquery defined with the AUTO-INCREMENT column +# and used with the ZEROFILL column +# +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (b INT ZEROFILL); +INSERT INTO t2 VALUES (2), (3); +SELECT * +FROM t2 +WHERE t2.b IN (SELECT MIN(t1.a) from t1); +b +DROP TABLE t1, t2; diff --git a/mysql-test/main/in_subq_cond_pushdown.test b/mysql-test/main/in_subq_cond_pushdown.test index b336f39a1c9..fe317c3bf94 100644 --- a/mysql-test/main/in_subq_cond_pushdown.test +++ b/mysql-test/main/in_subq_cond_pushdown.test @@ -757,3 +757,19 @@ EVAL EXPLAIN FORMAT=JSON $query; DROP TABLE t1,t2,t3; DROP VIEW v1,v2; + +--echo # +--echo # MDEV-16721: IN-subquery defined with the AUTO-INCREMENT column +--echo # and used with the ZEROFILL column +--echo # + +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); +CREATE TABLE t2 (b INT ZEROFILL); + +INSERT INTO t2 VALUES (2), (3); + +SELECT * +FROM t2 +WHERE t2.b IN (SELECT MIN(t1.a) from t1); + +DROP TABLE t1, t2; diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index efc38e5fe66..de8cf1e54a1 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -5738,7 +5738,8 @@ bool execute_degenerate_jtbm_semi_join(THD *thd, new (thd->mem_root) Item_func_eq(thd, subq_pred->left_expr->element_index(i), new_sink->row[i]); - if (!eq_cond || eq_list.push_back(eq_cond, thd->mem_root)) + if (!eq_cond || eq_cond->fix_fields(thd, NULL) || + eq_list.push_back(eq_cond, thd->mem_root)) DBUG_RETURN(TRUE); } }
participants (1)
-
Galina