Skip to content
Permalink
Browse files
Merge branch '10.3' into 10.4
  • Loading branch information
vuvova committed Jan 10, 2023
2 parents 6cb8434 + 56948ee commit fdcfc25
Show file tree
Hide file tree
Showing 38 changed files with 524 additions and 116 deletions.
@@ -2032,6 +2032,17 @@ Warnings:
Warning 1280 Name 'foo' ignored for PRIMARY key.
DROP TABLE t1;
#
# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
#
create table t1(c1 varchar(1));
insert into t1(c1) values('#');
select @@sql_mode like '%strict_all_tables%';
@@sql_mode like '%strict_all_tables%'
0
create table t2 as select if(c1 = '#', c1 = 0, c1) as c1 from t1;
ERROR 22007: Truncated incorrect DECIMAL value: '#'
drop table t1;
#
# End of 10.3 tests
#
#
@@ -1892,6 +1892,19 @@ create table t1 (c int(10) unsigned) engine=memory transactional=0;
CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2));
DROP TABLE t1;

--echo #
--echo # MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
--echo #

create table t1(c1 varchar(1));
insert into t1(c1) values('#');

select @@sql_mode like '%strict_all_tables%';
--error ER_TRUNCATED_WRONG_VALUE
create table t2 as select if(c1 = '#', c1 = 0, c1) as c1 from t1;

drop table t1;

--echo #
--echo # End of 10.3 tests
--echo #
@@ -1,4 +1,3 @@
drop table if exists t1,t2,t3,t4,t5,t6;
set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
@@ -2567,5 +2566,15 @@ stddev_samp(i) stddev_pop(i) stddev(i) std(i)
drop view v1;
drop table t1;
#
# MDEV-29988: Major performance regression with 10.6.11
#
create table t1 (a varchar(10) charset utf8mb4, b int, c int);
insert t1 values (1,2,3),(4,5,6),(1,7,8);
select concat(a,":",group_concat(b)) from t1 group by a;
concat(a,":",group_concat(b))
1:2,7
4:5
drop table t1;
#
# End of 10.3 tests
#
@@ -2,10 +2,6 @@
# simple test of all group functions
#

--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6;
--enable_warnings

set @sav_dpi= @@div_precision_increment;
set div_precision_increment= 5;
show variables like 'div_precision_increment';
@@ -1801,6 +1797,14 @@ select * from v1;
drop view v1;
drop table t1;

--echo #
--echo # MDEV-29988: Major performance regression with 10.6.11
--echo #
create table t1 (a varchar(10) charset utf8mb4, b int, c int);
insert t1 values (1,2,3),(4,5,6),(1,7,8);
select concat(a,":",group_concat(b)) from t1 group by a;
drop table t1;

--echo #
--echo # End of 10.3 tests
--echo #
@@ -1042,4 +1042,17 @@ select * from t1;
a
deallocate prepare stmt;
drop table t1,t2,t3;
#
# MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
#
create table t1(c1 varchar(1));
create table t2(c1 varchar(1));
insert into t1(c1) values('#');
select @@sql_mode like '%strict_all_tables%';
@@sql_mode like '%strict_all_tables%'
0
insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1;
drop table t1, t2;
#
# End of 10.3 test
#
@@ -595,4 +595,21 @@ deallocate prepare stmt;

drop table t1,t2,t3;


--echo #
--echo # MDEV-30342 Wrong "Truncated incorrect DECIMAL value" warning/error
--echo #

create table t1(c1 varchar(1));
create table t2(c1 varchar(1));

insert into t1(c1) values('#');

select @@sql_mode like '%strict_all_tables%';
insert into t2(c1) select if(c1 = '#', c1 = 0, c1) as c1 from t1;

drop table t1, t2;

--echo #
--echo # End of 10.3 test
--echo #
@@ -1999,3 +1999,55 @@ Note 1003 select `test`.`t3`.`pk` AS `pk`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`
DROP TABLE t1,t2,t3;
set join_cache_level= @save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
#
# MDEV-27624: Nested left joins with not_exists optimization
# for most inner left join
#
set @save_join_cache_level= @@join_cache_level;
CREATE TABLE t1 (a INT NOT NULL, b INT, c INT);
INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1);
CREATE TABLE t2(a INT NOT NULL);
INSERT INTO t2 VALUES (1), (2);
CREATE TABLE t3(a INT not null, b INT);
INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1);
set join_cache_level = 0;
EXPLAIN SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists
SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
a b c a a b
1 3 1 NULL NULL NULL
set join_cache_level = 2;
EXPLAIN SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists; Using join buffer (incremental, BNL join)
SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
a b c a a b
1 3 1 NULL NULL NULL
DROP TABLE t1, t2, t3;
set join_cache_level= @save_join_cache_level;
# end of 10.3 tests
@@ -1419,3 +1419,41 @@ DROP TABLE t1,t2,t3;
set join_cache_level= @save_join_cache_level;

set optimizer_switch=@save_optimizer_switch;

--echo #
--echo # MDEV-27624: Nested left joins with not_exists optimization
--echo # for most inner left join
--echo #

set @save_join_cache_level= @@join_cache_level;

CREATE TABLE t1 (a INT NOT NULL, b INT, c INT);
INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1);

CREATE TABLE t2(a INT NOT NULL);
INSERT INTO t2 VALUES (1), (2);

CREATE TABLE t3(a INT not null, b INT);
INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1);

let $q=
SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;

set join_cache_level = 0;
eval EXPLAIN $q;
eval $q;

set join_cache_level = 2;
eval EXPLAIN $q;
eval $q;

DROP TABLE t1, t2, t3;

set join_cache_level= @save_join_cache_level;

--echo # end of 10.3 tests
@@ -2008,6 +2008,58 @@ Note 1003 select `test`.`t3`.`pk` AS `pk`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`
DROP TABLE t1,t2,t3;
set join_cache_level= @save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
#
# MDEV-27624: Nested left joins with not_exists optimization
# for most inner left join
#
set @save_join_cache_level= @@join_cache_level;
CREATE TABLE t1 (a INT NOT NULL, b INT, c INT);
INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1);
CREATE TABLE t2(a INT NOT NULL);
INSERT INTO t2 VALUES (1), (2);
CREATE TABLE t3(a INT not null, b INT);
INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1);
set join_cache_level = 0;
EXPLAIN SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists
SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
a b c a a b
1 3 1 NULL NULL NULL
set join_cache_level = 2;
EXPLAIN SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Not exists; Using join buffer (incremental, BNL join)
SELECT *
FROM t1
LEFT JOIN
( t2 LEFT JOIN t3 ON t2.a = t3.b )
ON t2.a = 1 AND (t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
WHERE t1.c = 1 AND t3.a is NULL;
a b c a a b
1 3 1 NULL NULL NULL
DROP TABLE t1, t2, t3;
set join_cache_level= @save_join_cache_level;
# end of 10.3 tests
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
@@ -5722,6 +5722,24 @@ EXECUTE stmt USING 'd';
EXECUTE stmt USING 'd';
300
DROP TABLE t1, t2, t3;
set @@max_session_mem_used=default;
create table t (a varchar(10)) character set utf8;
insert into t values ('');
prepare stmt from "select 1 from t where a = ?";
set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id());
deallocate prepare stmt;
drop table t;
set @@max_session_mem_used=default;
create table t (a varchar(10)) character set utf8;
insert into t values ('');
prepare stmt from "select 1 from t where a = 'a'";
set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id());
deallocate prepare stmt;
drop table t;
set @@max_session_mem_used=default;
#
# End of 10.3 tests
#
#
# MDEV-19263: Server crashes in mysql_handle_single_derived
# upon 2nd execution of PS
@@ -5109,6 +5109,45 @@ EXECUTE stmt USING 'd';
EXECUTE stmt USING 'd';
DROP TABLE t1, t2, t3;

set @@max_session_mem_used=default;
create table t (a varchar(10)) character set utf8;
insert into t values ('');
prepare stmt from "select 1 from t where a = ?";
set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id());
let $run= 1000;
disable_result_log;
disable_query_log;
while ($run) {
execute stmt using repeat('x',10000);
dec $run;
}
enable_result_log;
enable_query_log;
deallocate prepare stmt;
drop table t;
set @@max_session_mem_used=default;

create table t (a varchar(10)) character set utf8;
insert into t values ('');
prepare stmt from "select 1 from t where a = 'a'";
set @@max_session_mem_used=(select memory_used*2 from information_schema.processlist where id=connection_id());
let $run= 1000;
disable_result_log;
disable_query_log;
while ($run) {
execute stmt;
dec $run;
}
enable_result_log;
enable_query_log;
deallocate prepare stmt;
drop table t;
set @@max_session_mem_used=default;

--echo #
--echo # End of 10.3 tests
--echo #

--echo #
--echo # MDEV-19263: Server crashes in mysql_handle_single_derived
--echo # upon 2nd execution of PS
@@ -36,7 +36,7 @@ echo '[Service]'
echo


if [[ ( "$user" != "root" && "$user" != "mysql" ) || "${SET_USER}" == 1 ]]; then
if [[ ( ! -z "$user" && "$user" != "root" && "$user" != "mysql" ) || "${SET_USER}" == 1 ]]; then
echo User=$user
fi

@@ -11152,7 +11152,7 @@ Create_field *Create_field::clone(MEM_ROOT *mem_root) const
}

/**
Return true if default is an expression that must be saved explicitely
Return true if default is an expression that must be saved explicitly

This is:
- Not basic constants
@@ -4933,7 +4933,7 @@ class Column_definition: public Sql_alloc,
Record_addr addr(true);
return make_field(share, mem_root, &addr, field_name_arg);
}
/* Return true if default is an expression that must be saved explicitely */
/* Return true if default is an expression that must be saved explicitly */
bool has_default_expression();

bool has_default_now_unireg_check() const

0 comments on commit fdcfc25

Please sign in to comment.