diff options
author | Sergei Krivonos <sergei.krivonos@mariadb.com> | 2021-12-14 16:16:05 +0200 |
---|---|---|
committer | Sergei Krivonos <sergei.krivonos@mariadb.com> | 2021-12-15 17:19:35 +0200 |
commit | 831b2165fdefbbcaff196c95ff17460a1d3c8bbd (patch) | |
tree | f3dd070847a4ff0e6242f07ad0a77816ae2b7803 | |
parent | 20f22dfa2f2d5bb5a1511d42a5bb18fbf469e812 (diff) | |
download | mariadb-git-bb-10.4-MDEV-27238.tar.gz |
MDEV-27238: detecting Json_writer_struct nesting issuesbb-10.4-MDEV-27238
-rw-r--r-- | mysql-test/main/opt_trace.result | 28 | ||||
-rw-r--r-- | mysql-test/main/opt_trace.test | 11 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 |
3 files changed, 38 insertions, 7 deletions
diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 0e4477e1fd9..8f5ee8fbcf7 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -2393,7 +2393,8 @@ select t1.a from t1 left join t2 on t1.a=t2.a { "best_join_order": ["t2", "t1"] }, { - "condition_on_constant_tables": "1" + "condition_on_constant_tables": "1", + "computing condition": [] }, { "attaching_conditions_to_tables": { @@ -2550,7 +2551,8 @@ explain select * from t1 left join t2 on t2.a=t1.a { "best_join_order": ["t1", "t2"] }, { - "condition_on_constant_tables": "1" + "condition_on_constant_tables": "1", + "computing condition": [] }, { "attaching_conditions_to_tables": { @@ -2708,7 +2710,8 @@ explain select t1.a from t1 left join (t2 join t3 on t2.b=t3.b) on t2.a=t1.a and "best_join_order": ["t3", "t2", "t1"] }, { - "condition_on_constant_tables": "1" + "condition_on_constant_tables": "1", + "computing condition": [] }, { "attaching_conditions_to_tables": { @@ -3021,7 +3024,8 @@ explain extended select * from t1 where a in (select pk from t10) { "best_join_order": ["t1", "<subquery2>"] }, { - "condition_on_constant_tables": "1" + "condition_on_constant_tables": "1", + "computing condition": [] }, { "attaching_conditions_to_tables": { @@ -4719,7 +4723,8 @@ explain select * from t1 where a in (select t_inner_1.a from t1 t_inner_1, t1 t_ "best_join_order": ["t1", "<subquery2>"] }, { - "condition_on_constant_tables": "1" + "condition_on_constant_tables": "1", + "computing condition": [] }, { "attaching_conditions_to_tables": { @@ -7365,7 +7370,8 @@ t_outer_2.a in (select t_inner_3.a from t2 t_inner_3, t1 t_inner_4) { ] }, { - "condition_on_constant_tables": "1" + "condition_on_constant_tables": "1", + "computing condition": [] }, { "attaching_conditions_to_tables": { @@ -8632,5 +8638,15 @@ SELECT 'a\0' LIMIT 0 { } SET optimizer_trace=DEFAULT; # +# MDEV-27238: Assertion `got_name == named_item_expected()' failed in Json_writer::on_start_object on JSON-less testcase using optimizer_trace +# +SET sql_mode=''; +CREATE TABLE t1 (a INT KEY,b INT,KEY(b)) ENGINE=MEMORY; +SET optimizer_trace=1; +INSERT INTO t1 VALUES (0,0); +SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d); +a +DROP TABLE t1; +# # End of 10.4 tests # diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 9d4794855e0..6ef0535a6c3 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -644,5 +644,16 @@ SELECT query, trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE; SET optimizer_trace=DEFAULT; --echo # +--echo # MDEV-27238: Assertion `got_name == named_item_expected()' failed in Json_writer::on_start_object on JSON-less testcase using optimizer_trace +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (a INT KEY,b INT,KEY(b)) ENGINE=MEMORY; +SET optimizer_trace=1; +INSERT INTO t1 VALUES (0,0); +SELECT a FROM t1 WHERE (a,b) in (SELECT @c,@d); +DROP TABLE t1; + +--echo # --echo # End of 10.4 tests --echo # diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 27fc27f242a..dbfa4c00288 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11409,7 +11409,11 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) } else { - const bool const_cond_result = const_cond->val_int() != 0; + bool const_cond_result; + { + Json_writer_array a(thd, "computing condition"); + const_cond_result= const_cond->val_int() != 0; + } if (!const_cond_result) { DBUG_PRINT("info",("Found impossible WHERE condition")); |