diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c97f9827e59..b519bfd8f3c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -32,7 +32,7 @@ Without automated tests, future regressions in the expected behavior can't be au If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually. ## Basing the PR against the correct MariaDB version - [ ] *This is a new feature and the PR is based against the latest MariaDB development branch.* diff --git a/VERSION b/VERSION index 18b3c9acff0..45539fc57d9 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=11 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=4 +MYSQL_VERSION_PATCH=5 SERVER_MATURITY=stable diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 0336de08e50..0c60fdc4f9f 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -2545,3 +2545,24 @@ SET @@collation_connection= @save_collation_connection; # # End of 10.9 Test # +# +# MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-) +# as first character in key +# +CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS +SELECT '{ "-1234" : "something", + "12-34" : "else", + "1234-" : "and", + "1234" : "match" }' AS 'message'; +SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, +JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, +JSON_SEARCH(message, 'one', 'else') AS t2_path, +JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, +JSON_SEARCH(message, 'one', 'and') AS t3_path, +JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, +JSON_SEARCH(message, 'one', 'match') AS t4_path, +JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result +FROM jsonTest; +t1_path t1_result t2_path t2_result t3_path t3_result t4_path t4_result +"$.-1234" something "$.12-34" else "$.1234-" and "$.1234" match +# End of 11.0 test diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 2218a976c31..bec8404e78b 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -1828,3 +1828,26 @@ SET @@collation_connection= @save_collation_connection; --echo # --echo # End of 10.9 Test --echo # + +--echo # +--echo # MDEV-32007: JSON_VALUE and JSON_EXTRACT doesn't handle dash (-) +--echo # as first character in key +--echo # + +CREATE TEMPORARY TABLE IF NOT EXISTS jsonTest AS + SELECT '{ "-1234" : "something", + "12-34" : "else", + "1234-" : "and", + "1234" : "match" }' AS 'message'; + +SELECT JSON_SEARCH(message, 'one', 'something') AS t1_path, + JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'something'))) AS t1_result, + JSON_SEARCH(message, 'one', 'else') AS t2_path, + JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'else'))) AS t2_result, + JSON_SEARCH(message, 'one', 'and') AS t3_path, + JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'and'))) AS t3_result, + JSON_SEARCH(message, 'one', 'match') AS t4_path, + JSON_VALUE(message, JSON_UNQUOTE(JSON_SEARCH(message, 'one', 'match'))) AS t4_result +FROM jsonTest; + +--echo # End of 11.0 test diff --git a/mysql-test/main/order_by_innodb.result b/mysql-test/main/order_by_innodb.result index 2f5e3c31e7a..5516c5636a0 100644 --- a/mysql-test/main/order_by_innodb.result +++ b/mysql-test/main/order_by_innodb.result @@ -306,3 +306,13 @@ a b c 6 2 26 6 3 36 drop table t1; +# +# MDEV-31116: SIGSEGV in test_if_skip_sort_order|JOIN::optimize_stage2 +# +CREATE TABLE t1 (a BINARY (2),b BINARY (1),KEY(a)) ENGINE=innodb; +INSERT INTO t1 select 'ab', NULL from seq_1_to_14; +SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a >'') ORDER BY a LIMIT 1; +a b +ab NULL +DROP TABLE t1; +# End of 11.0 tests diff --git a/mysql-test/main/order_by_innodb.test b/mysql-test/main/order_by_innodb.test index bc56975ca79..6dab3baac13 100644 --- a/mysql-test/main/order_by_innodb.test +++ b/mysql-test/main/order_by_innodb.test @@ -252,3 +252,12 @@ explain select * from t1 force index(r) order by a,b limit 20; explain select * from t1 force index(r) order by a desc,b limit 20; select * from t1 force index(r) order by a desc,b limit 20; drop table t1; + +--echo # +--echo # MDEV-31116: SIGSEGV in test_if_skip_sort_order|JOIN::optimize_stage2 +--echo # +CREATE TABLE t1 (a BINARY (2),b BINARY (1),KEY(a)) ENGINE=innodb; +INSERT INTO t1 select 'ab', NULL from seq_1_to_14; +SELECT * FROM t1 WHERE a IN (SELECT a FROM t1 WHERE a >'') ORDER BY a LIMIT 1; +DROP TABLE t1; +--echo # End of 11.0 tests diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f952058247f..aebffd7f3d7 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -26596,7 +26596,7 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, !table->is_clustering_key(best_key))) goto use_filesort; - if (table->opt_range_keys.is_set(best_key) && best_key != ref_key) + if (select && table->opt_range_keys.is_set(best_key) && best_key != ref_key) { key_map tmp_map; tmp_map.clear_all(); // Force the creation of quick select diff --git a/strings/json_lib.c b/strings/json_lib.c index 52c173f3604..47e0843d627 100644 --- a/strings/json_lib.c +++ b/strings/json_lib.c @@ -1093,7 +1093,7 @@ static int json_path_transitions[N_PATH_STATES][N_PATH_CLASSES]= /* AS */ { JE_EOS, JE_SYN, JE_SYN, JE_SYN, PS_T, PS_PT, JE_SYN, PS_NEG, PS_Z, PS_INT, PS_LAST, PS_AS, JE_SYN, JE_SYN, JE_SYN, JE_NOT_JSON_CHR, JE_BAD_CHR}, -/* KEY */ { JE_EOS, PS_KNM, PS_KWD, JE_SYN, PS_KNM, PS_KNM, JE_SYN, JE_SYN, +/* KEY */ { JE_EOS, PS_KNM, PS_KWD, JE_SYN, PS_KNM, PS_KNM, JE_SYN, PS_KNM, PS_KNM, PS_KNM, PS_KNM, PS_KNM, PS_KNM, JE_SYN, PS_KEYX, PS_KNM, JE_NOT_JSON_CHR, JE_BAD_CHR}, /* KNM */ { PS_KOK, PS_KNM, PS_AST, PS_EAR, PS_KNM, PS_KNM, PS_EKY, PS_KNM,