[Commits] b9bc3c24630: Merge branch '5.5' into 10.0
revision-id: b9bc3c24630980b260b91fc856689dbad336064e (mariadb-10.0.36-13-gb9bc3c24630) parent(s): b3c320bb0b93e516cda4db277cfa3efeef48c988 43c393ff4732e9ea8719864abeb73cefd5b528a9 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-09-03 10:57:02 +0200 message: Merge branch '5.5' into 10.0 mysql-test/mysql-test-run.pl | 2 +- mysql-test/r/join.result | 6 ++++-- mysql-test/r/sp.result | 17 +++++++++++++++++ mysql-test/suite/maria/maria.result | 4 ++++ mysql-test/suite/maria/maria.test | 10 ++++++++++ mysql-test/t/join.test | 3 ++- mysql-test/t/sp.test | 21 +++++++++++++++++++++ sql/item.cc | 10 ++++------ sql/sql_base.cc | 14 +++++++++++++- sql/table.h | 10 ++++++++++ storage/maria/ma_blockrec.c | 18 +++++++++++++----- 11 files changed, 99 insertions(+), 16 deletions(-) diff --cc mysql-test/mysql-test-run.pl index f6d8cda592d,ade3f99104e..63801357dd5 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@@ -1463,7 -1457,7 +1463,7 @@@ sub command_line_setup foreach my $fs (@tmpfs_locations) { - if ( -d $fs && ! -l $fs ) - if ( -d $fs && -w $fs ) ++ if ( -d $fs && ! -l $fs && -w $fs ) { my $template= "var_${opt_build_thread}_XXXX"; $opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0); diff --cc mysql-test/r/sp.result index 2cb1b701e2d,4535056242a..058ef69c548 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@@ -7898,95 -8055,21 +7898,112 @@@ SET S.CLOSE_YN = ' where 1=1; drop function if exists f1; drop table t1,t2; + # + # MDEV-16957: Server crashes in Field_iterator_natural_join::next + # upon 2nd execution of SP + # + CREATE TABLE t1 (a INT, b VARCHAR(32)); + CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c); + CALL sp; + ERROR 42S22: Unknown column 'c' in 'from clause' + CALL sp; + ERROR 42S22: Unknown column 'c' in 'from clause' + CALL sp; + ERROR 42S22: Unknown column 'c' in 'from clause' + alter table t1 add column c int; + CALL sp; + c a b a b + DROP PROCEDURE sp; + DROP TABLE t1; # End of 5.5 test +# +# MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2 +# +create table t1 ( +col1 bigint(20), +col2 char(1), +col3 char(2) +); +insert into t1 values (1,'a','a'), (2,'b','b'); +create table t2 as select * from t1; +create table t3 as select * from t1; +create table t4 as select * from t1; +create table t5 as select * from t1; +create table t6 as select * from t1; +flush tables; +CREATE PROCEDURE p1() +begin +DECLARE _var1 bigint(20) UNSIGNED; +DECLARE _var2 CHAR(1) DEFAULT NULL; +DECLARE _var3 CHAR(1) DEFAULT NULL; +DECLARE _done BOOLEAN DEFAULT 0; +declare cur1 cursor for +select col1, col2, col3 +from t1 +where +col1 in (select t2.col1 from t2 where t2.col2=t1.col2) or +col2 in (select t3.col3 from t3 where t3.col3=t1.col2) ; +DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1; +OPEN cur1; +set _var1 = (select _var1 from t4 limit 1); +set _var1 = (select _var1 from t5 limit 1); +set _var1 = (select _var1 from t6 limit 1); +label1: +LOOP +SET _done = 0; +FETCH cur1 INTO _var1, _var2, _var3; +IF _done THEN +LEAVE label1; +END IF; +END LOOP label1; +CLOSE cur1; +end| +set @tmp_toc= @@table_open_cache; +set @tmp_tdc= @@table_definition_cache; +set global table_open_cache=1; +set global table_definition_cache=1; +Warnings: +Warning 1292 Truncated incorrect table_definition_cache value: '1' +call p1(); +set global table_open_cache= @tmp_toc; +set global table_definition_cache= @tmp_tdc; +drop procedure p1; +drop table t1,t2,t3,t4,t5,t6; +# +# MDEV-11935: Queries in stored procedures with and +# EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton. +# +CREATE TABLE ANY_TABLE ( +ENTITY_UID BIGINT NOT NULL +); +CREATE TABLE SECURITY_PATH( +origid BIGINT UNSIGNED NOT NULL, +destid BIGINT UNSIGNED NOT NULL, +KEY (destid) +); +CREATE VIEW ENTITY_ACCESS ( +ENTITY_UID, +OWNER_UID +) AS +SELECT SP1.origid, +SP2.destid +FROM SECURITY_PATH SP1 +JOIN SECURITY_PATH SP2 ON SP1.destid = SP2.origid +; +CREATE PROCEDURE SP_EXAMPLE_SELECT () +BEGIN +SELECT * +FROM ANY_TABLE AT1 +WHERE EXISTS ( SELECT * +FROM ENTITY_ACCESS EA +WHERE AT1.ENTITY_UID = EA.ENTITY_UID +AND EA.OWNER_UID IS NULL ); +END +// +CALL SP_EXAMPLE_SELECT (); +ENTITY_UID +CALL SP_EXAMPLE_SELECT (); +ENTITY_UID +drop procedure SP_EXAMPLE_SELECT; +drop view ENTITY_ACCESS; +drop table ANY_TABLE, SECURITY_PATH; diff --cc mysql-test/t/sp.test index c5d37d1017d,cb93cd31442..1b765f0eb2d --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@@ -9353,112 -9353,25 +9353,133 @@@ where 1=1 drop function if exists f1; drop table t1,t2; + --echo # + --echo # MDEV-16957: Server crashes in Field_iterator_natural_join::next + --echo # upon 2nd execution of SP + --echo # + + CREATE TABLE t1 (a INT, b VARCHAR(32)); + CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c); + --error ER_BAD_FIELD_ERROR + CALL sp; + --error ER_BAD_FIELD_ERROR + CALL sp; + --error ER_BAD_FIELD_ERROR + CALL sp; + alter table t1 add column c int; + CALL sp; + + # Cleanup + DROP PROCEDURE sp; + DROP TABLE t1; + + --echo # End of 5.5 test + +--echo # +--echo # MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2 +--echo # +create table t1 ( + col1 bigint(20), + col2 char(1), + col3 char(2) +); +insert into t1 values (1,'a','a'), (2,'b','b'); + +create table t2 as select * from t1; +create table t3 as select * from t1; +create table t4 as select * from t1; +create table t5 as select * from t1; +create table t6 as select * from t1; + +flush tables; + +DELIMITER |; + +CREATE PROCEDURE p1() +begin + DECLARE _var1 bigint(20) UNSIGNED; + DECLARE _var2 CHAR(1) DEFAULT NULL; + DECLARE _var3 CHAR(1) DEFAULT NULL; + + DECLARE _done BOOLEAN DEFAULT 0; + + declare cur1 cursor for + select col1, col2, col3 + from t1 + where + col1 in (select t2.col1 from t2 where t2.col2=t1.col2) or + col2 in (select t3.col3 from t3 where t3.col3=t1.col2) ; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET _done = 1; + + OPEN cur1; + + set _var1 = (select _var1 from t4 limit 1); + set _var1 = (select _var1 from t5 limit 1); + set _var1 = (select _var1 from t6 limit 1); +label1: + LOOP + SET _done = 0; + FETCH cur1 INTO _var1, _var2, _var3; + IF _done THEN + LEAVE label1; + END IF; + END LOOP label1; + CLOSE cur1; +end| +DELIMITER ;| + +set @tmp_toc= @@table_open_cache; +set @tmp_tdc= @@table_definition_cache; + +set global table_open_cache=1; +set global table_definition_cache=1; +call p1(); + +set global table_open_cache= @tmp_toc; +set global table_definition_cache= @tmp_tdc; +drop procedure p1; + +drop table t1,t2,t3,t4,t5,t6; + +--echo # +--echo # MDEV-11935: Queries in stored procedures with and +--echo # EXISTS(SELECT * FROM VIEW) crashes and closes hte conneciton. +--echo # + +CREATE TABLE ANY_TABLE ( + ENTITY_UID BIGINT NOT NULL +); +CREATE TABLE SECURITY_PATH( +origid BIGINT UNSIGNED NOT NULL, +destid BIGINT UNSIGNED NOT NULL, +KEY (destid) +); +CREATE VIEW ENTITY_ACCESS ( +ENTITY_UID, +OWNER_UID +) AS +SELECT SP1.origid, + SP2.destid +FROM SECURITY_PATH SP1 +JOIN SECURITY_PATH SP2 ON SP1.destid = SP2.origid +; +--delimiter // +CREATE PROCEDURE SP_EXAMPLE_SELECT () +BEGIN + SELECT * + FROM ANY_TABLE AT1 + WHERE EXISTS ( SELECT * + FROM ENTITY_ACCESS EA + WHERE AT1.ENTITY_UID = EA.ENTITY_UID + AND EA.OWNER_UID IS NULL ); +END +// +--delimiter ; +CALL SP_EXAMPLE_SELECT (); +CALL SP_EXAMPLE_SELECT (); + +drop procedure SP_EXAMPLE_SELECT; +drop view ENTITY_ACCESS; +drop table ANY_TABLE, SECURITY_PATH;
participants (1)
-
Oleksandr Byelkin