diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result index 36e7baada00..f1eb1dc1268 100644 --- a/mysql-test/main/cte_nonrecursive.result +++ b/mysql-test/main/cte_nonrecursive.result @@ -1126,7 +1126,7 @@ NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 with cte_e as (with cte_o as (with cte_i as (select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2` +Note 1003 with cte_e as (with cte_o as (with cte_i as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 7)/* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1)/* select#4 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 3 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1 union /* select#5 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4 and `test`.`t1`.`a` > 1 and `test`.`t1`.`a` < 7 and `test`.`t1`.`a` > 1)/* select#1 */ select `cte_e1`.`a` AS `a` from `cte_e` `cte_e1` where `cte_e1`.`a` > 1 union /* select#6 */ select `cte_e2`.`a` AS `a` from `cte_e` `cte_e2` drop table t1; # # MDEV-13753: embedded CTE in a VIEW created in prepared statement diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index dedef068129..805352307ba 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -4790,3 +4790,22 @@ a NULL DROP TABLE t1; # End of 10.3 tests +# +# MDEV-26108: Recursive CTE embedded into another CTE which is used twice +# +create table t1 (a int); +insert into t1 values (5), (7); +with cte_e as ( +with recursive cte_r as ( +select a from t1 union select a+1 as a from cte_r r where a < 10 +) select * from cte_r +) select * from cte_e s1, cte_e s2 where s1.a=s2.a; +a a +5 5 +7 7 +6 6 +8 8 +9 9 +10 10 +drop table t1; +# End of 10.4 tests diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index 125e22ebfa6..9adb2de7ec5 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -3087,3 +3087,20 @@ SELECT * FROM cte; DROP TABLE t1; --echo # End of 10.3 tests + +--echo # +--echo # MDEV-26108: Recursive CTE embedded into another CTE which is used twice +--echo # + +create table t1 (a int); +insert into t1 values (5), (7); + +with cte_e as ( + with recursive cte_r as ( + select a from t1 union select a+1 as a from cte_r r where a < 10 + ) select * from cte_r +) select * from cte_e s1, cte_e s2 where s1.a=s2.a; + +drop table t1; + +--echo # End of 10.4 tests diff --git a/mysql-test/main/wolfssl.result b/mysql-test/main/wolfssl.result new file mode 100644 index 00000000000..88df540ca95 --- /dev/null +++ b/mysql-test/main/wolfssl.result @@ -0,0 +1,3 @@ +SELECT @@ssl_cipher; +@@ssl_cipher +ECDHE-RSA-AES256-GCM-SHA384 diff --git a/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff b/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff new file mode 100644 index 00000000000..379514edad9 --- /dev/null +++ b/mysql-test/suite/innodb/r/instant_alter_debug,dynamic.rdiff @@ -0,0 +1,6 @@ +@@ -470,4 +470,4 @@ + FROM information_schema.global_status + WHERE variable_name = 'innodb_instant_alter_column'; + instants +-33 ++32 diff --git a/mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf b/mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf new file mode 100644 index 00000000000..eee52ede869 --- /dev/null +++ b/mysql-test/suite/perfschema/include/default_mysqld_autosize.cnf @@ -0,0 +1,53 @@ + +# Default values that applies to all MySQL Servers +[mysqld] +local-infile +character-set-server= latin1 +default-storage-engine=myisam + +# Increase default connect_timeout to avoid intermittent +# disconnects when test servers are put under load see BUG#28359 +connect-timeout= 60 + +log-bin-trust-function-creators=1 +key_buffer_size= 1M +sort_buffer_size= 256K +max_heap_table_size= 1M + +loose-innodb_data_file_path= ibdata1:10M:autoextend +loose-innodb_buffer_pool_size= 8M +loose-innodb_lru_scan_depth= 100 +loose-innodb_write_io_threads= 2 +loose-innodb_read_io_threads= 2 +loose-innodb_log_buffer_size= 1M +loose-innodb_log_file_size= 5M +loose-innodb_log_files_in_group= 2 + +slave-net-timeout=120 + +log-bin=mysqld-bin + +# No performance schema sizing provided + +# Disable everything, we only need the sizing data, +# and also need a stable output for show engine performance_schema status +loose-performance-schema-consumer-global-instrumentation=OFF + +loose-performance-schema-instrument='%=ON' + +loose-performance-schema-consumer-events-stages-current=ON +loose-performance-schema-consumer-events-stages-history=ON +loose-performance-schema-consumer-events-stages-history-long=ON +loose-performance-schema-consumer-events-statements-current=ON +loose-performance-schema-consumer-events-statements-history=ON +loose-performance-schema-consumer-events-statements-history-long=ON +loose-performance-schema-consumer-events-transactions-current=ON +loose-performance-schema-consumer-events-transactions-history=ON +loose-performance-schema-consumer-events-transactions-history-long=ON +loose-performance-schema-consumer-events-waits-current=ON +loose-performance-schema-consumer-events-waits-history=ON +loose-performance-schema-consumer-events-waits-history-long=ON +loose-performance-schema-consumer-thread-instrumentation=ON + +binlog-direct-non-transactional-updates + diff --git a/mysql-test/suite/perfschema/include/have_aligned_memory.inc b/mysql-test/suite/perfschema/include/have_aligned_memory.inc index 9638cbe1da4..d420f0e055a 100644 --- a/mysql-test/suite/perfschema/include/have_aligned_memory.inc +++ b/mysql-test/suite/perfschema/include/have_aligned_memory.inc @@ -4,10 +4,7 @@ # For tests sensitive to the internal sizes (show engine performance_schema # status), make sure we use a platform with aligned memory. ---disable_query_log -let $aligned = `SELECT count(*) from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`; -if (!$aligned) +if (`SELECT count(*)=0 from performance_schema.session_connect_attrs where PROCESSLIST_ID = connection_id() and ATTR_NAME = '_os' and ATTR_VALUE in ('Linux', 'Windows')`) { skip Need a platform with aligned memory; } ---enable_query_log diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 1dbdfbd9b1f..2403a6d9f17 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -1039,6 +1039,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex, bool parse_status= false; st_select_lex *with_select; + st_select_lex *last_clone_select; char save_end= unparsed_spec.str[unparsed_spec.length]; ((char*) &unparsed_spec.str[unparsed_spec.length])[0]= '\0'; @@ -1125,11 +1126,14 @@ st_select_lex_unit *With_element::clone_parsed_spec(LEX *old_lex, lex->unit.include_down(with_table->select_lex); lex->unit.set_slave(with_select); lex->unit.cloned_from= spec; + last_clone_select= lex->all_selects_list; + while (last_clone_select->next_select_in_list()) + last_clone_select= last_clone_select->next_select_in_list(); old_lex->all_selects_list= (st_select_lex*) (lex->all_selects_list-> - insert_chain_before( - (st_select_lex_node **) &(old_lex->all_selects_list), - with_select)); + insert_chain_before( + (st_select_lex_node **) &(old_lex->all_selects_list), + last_clone_select)); /* Now all references to the CTE defined outside of the cloned specification diff --git a/storage/spider/mysql-test/spider/r/basic_sql.result b/storage/spider/mysql-test/spider/r/basic_sql.result index ba904b5f577..2443f3488bd 100644 --- a/storage/spider/mysql-test/spider/r/basic_sql.result +++ b/storage/spider/mysql-test/spider/r/basic_sql.result @@ -721,6 +721,12 @@ connection master_1; create table t2345678911234567892123456789312345678941234567895123234234(id int) ENGINE=SPIDER COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"'; drop table t2345678911234567892123456789312345678941234567895123234234; +# +# MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes +# +create table mdev_26139 (id int) ENGINE=SPIDER +COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'"; +drop table mdev_26139; deinit connection master_1; diff --git a/storage/spider/mysql-test/spider/t/basic_sql.test b/storage/spider/mysql-test/spider/t/basic_sql.test index a3184a14beb..1298b10f19a 100644 --- a/storage/spider/mysql-test/spider/t/basic_sql.test +++ b/storage/spider/mysql-test/spider/t/basic_sql.test @@ -2682,6 +2682,13 @@ create table t2345678911234567892123456789312345678941234567895123234234(id int) COMMENT='host "192.168.21.1", user "spider", password "password", database "test32738123123123"'; drop table t2345678911234567892123456789312345678941234567895123234234; +--echo # +--echo # MDEV-26139 Spider crashes with segmentation fault (signal 11) on CREATE TABLE when COMMENT does not contain embedded double quotes +--echo # +create table mdev_26139 (id int) ENGINE=SPIDER + COMMENT="host '192.168.21.1', user 'spider', password 'password', database 'test'"; +drop table mdev_26139; + --echo --echo deinit --disable_warnings diff --git a/storage/spider/spd_table.h b/storage/spider/spd_table.h index c3f1dc09db5..2b40fb33d5a 100644 --- a/storage/spider/spd_table.h +++ b/storage/spider/spd_table.h @@ -189,7 +189,8 @@ typedef struct st_spider_param_string_parse { DBUG_RETURN(print_param_error()); } - else if (!sq || sq > dq) + + if (dq && (!sq || sq > dq)) { while (1) { @@ -227,7 +228,7 @@ typedef struct st_spider_param_string_parse } } } - else + else /* sq && (!dq || sq <= dq) */ { while (1) {