Skip to content
Permalink
Browse files
Merge 10.3 into 10.4
  • Loading branch information
dr-m committed Oct 25, 2022
2 parents f19e855 + 34ff5ca commit 667d3fb
Show file tree
Hide file tree
Showing 68 changed files with 1,349 additions and 130 deletions.
@@ -6864,7 +6864,12 @@ int main(int argc, char **argv)
if (flush_logs || opt_delete_master_logs)
{
if (mysql_refresh(mysql, REFRESH_LOG))
{
fprintf(stderr,
"Flush logs or delete master logs failure in server \n");
first_error= EX_MYSQLERR;
goto err;
}
verbose_msg("-- main : logs flushed successfully!\n");
}

@@ -5,7 +5,7 @@ export DEB_BUILD_HARDENING=1

# enable Debian Hardening
# see: https://wiki.debian.org/Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

@@ -34,12 +34,13 @@ extern "C" {
#ifndef __cplusplus
#define inline __inline
#endif
#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include <stdlib.h>
#else
#include <stdlib.h>
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
#endif
#endif

/* returned from encryption_key_get_latest_version() */
#define ENCRYPTION_KEY_VERSION_INVALID (~(unsigned int)0)
@@ -6398,6 +6398,17 @@ DEALLOCATE PREPARE stmt;
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-14983 Wrong error message with SET sql_mode=sha2(ucs2_value)
#
SET sql_mode=sha2(CONVERT('a' USING ucs2),0);
ERROR 42000: Variable 'sql_mode' can't be set to the value of '022a6979e6dab7aa5ae4c3e5e45f7e977112a7e63593820dbec1ec738a24f93c'
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
@@ -1095,6 +1095,21 @@ DEALLOCATE PREPARE stmt;
--echo # End of 10.2 tests
--echo #

--echo #
--echo # Start of 10.3 tests
--echo #

--echo #
--echo # MDEV-14983 Wrong error message with SET sql_mode=sha2(ucs2_value)
--echo #

--error ER_WRONG_VALUE_FOR_VAR
SET sql_mode=sha2(CONVERT('a' USING ucs2),0);

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

--echo #
--echo # Start of 10.4 tests
--echo #
@@ -1313,3 +1313,19 @@ a a
4 4
6 6
drop table t1,t2,t3;
#
# MDEV-16549: Server crashes in Item_field::fix_fields on query with
# view and subquery, Assertion `context' failed, Assertion `field' failed
#
CREATE TABLE t1 (a DECIMAL, b INT);
INSERT INTO t1 VALUES (1,1),(2,2);
CREATE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 WHERE a <> RAND() ) sq;
SELECT * FROM v1 WHERE b > 0;
a b
1 1
2 2
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.3 tests
#
@@ -1120,3 +1120,23 @@ analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select
select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;

drop table t1,t2,t3;


--echo #
--echo # MDEV-16549: Server crashes in Item_field::fix_fields on query with
--echo # view and subquery, Assertion `context' failed, Assertion `field' failed
--echo #

CREATE TABLE t1 (a DECIMAL, b INT);
INSERT INTO t1 VALUES (1,1),(2,2); # optional
CREATE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 WHERE a <> RAND() ) sq;

SELECT * FROM v1 WHERE b > 0;

# Cleanup
DROP VIEW v1;
DROP TABLE t1;

--echo #
--echo # End of 10.3 tests
--echo #
@@ -413,3 +413,49 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 system NULL NULL NULL NULL 1
drop table t1, t2;
# End of 10.1 tests
#
# End of 10.2 test
#
#
# MDEV-25564: Server crashed on running some EXPLAIN statements
#
EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
Warnings:
Note 1249 Select 3 was reduced during optimization
#
# MDEV-23160: SIGSEGV in Explain_node::print_explain_for_children on UNION SELECT
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
EXPLAIN
SELECT *
FROM t1
WHERE
a IN (SELECT a FROM t1
UNION
SELECT a FROM t1 ORDER BY (SELECT a))
UNION
SELECT * FROM t1 ORDER BY (SELECT a);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
3 DEPENDENT UNION t1 ALL NULL NULL NULL NULL 3 Using where
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
5 UNION t1 ALL NULL NULL NULL NULL 3
NULL UNION RESULT <union1,5> ALL NULL NULL NULL NULL NULL Using filesort
6 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
drop table t1;
explain
VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
5 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2
2 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
Warnings:
Note 1249 Select 4 was reduced during optimization
@@ -339,3 +339,34 @@ explain replace into t2 select 100, (select a from t1);
drop table t1, t2;

--echo # End of 10.1 tests

--echo #
--echo # End of 10.2 test
--echo #

--echo #
--echo # MDEV-25564: Server crashed on running some EXPLAIN statements
--echo #

EXPLAIN (SELECT 1,3) UNION (SELECT 2,1) ORDER BY (SELECT 2);

--echo #
--echo # MDEV-23160: SIGSEGV in Explain_node::print_explain_for_children on UNION SELECT
--echo #

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);

EXPLAIN
SELECT *
FROM t1
WHERE
a IN (SELECT a FROM t1
UNION
SELECT a FROM t1 ORDER BY (SELECT a))
UNION
SELECT * FROM t1 ORDER BY (SELECT a);
drop table t1;

explain
VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3));
@@ -2549,5 +2549,9 @@ Warning 1292 Truncated incorrect DOUBLE value: 'x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
DROP TABLE t1;
#
# MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
#
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
#
# End of 10.3 tests
#
@@ -1784,6 +1784,12 @@ CREATE TABLE t1 (a BIGINT) AS SELECT 1 AS v3 UNION SELECT FALSE ;
SELECT DISTINCT a IN ( COLLATION (AVG ('x'))) FROM t1 ;
DROP TABLE t1;

--echo #
--echo # MDEV-29678 Valgrind/MSAN uninitialised value errors upon PS with ALTER under ONLY_FULL_GROUP_BY
--echo #

SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';

--echo #
--echo # End of 10.3 tests
--echo #
@@ -707,6 +707,7 @@ a
#
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
a int(11) YES NULL
SHOW KEYS FROM t3;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t3 0 PRIMARY 1 a A 0 NULL NULL BTREE
@@ -246,6 +246,60 @@ connection default;
disconnect con1;
drop database db1;
drop user foo@localhost;
#
# MDEV-28455: CREATE TEMPORARY TABLES privilege
# is insufficient for SHOW COLUMNS
#
create database db;
create user foo@localhost;
create user bar@localhost;
create user buz@localhost;
grant create temporary tables on db.* to foo@localhost;
grant create temporary tables on db.* to bar@localhost;
connect con1,localhost,foo,,db;
create temporary table tmp (a int, key(a));
show tables;
Tables_in_db
show full tables;
Tables_in_db Table_type
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
show index in tmp;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
tmp 1 a 1 a A NULL NULL NULL YES BTREE
show columns in tmp;
Field Type Null Key Default Extra
a int(11) YES MUL NULL
show full columns in tmp;
Field Type Collation Null Key Default Extra Privileges Comment
a int(11) NULL YES MUL NULL select,insert,update,references
# we don't expect to show temporary tables in information_schema.columns
select * from information_schema.columns where table_schema='db';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT IS_GENERATED GENERATION_EXPRESSION
disconnect con1;
connect con1,localhost,bar,,db;
show full columns in tmp;
ERROR 42000: SELECT command denied to user 'bar'@'localhost' for table `db`.`tmp`
disconnect con1;
connection default;
grant select on db.* to bar@localhost;
connect con1,localhost,bar,,db;
show grants for current_user;
Grants for bar@localhost
GRANT USAGE ON *.* TO `bar`@`localhost`
GRANT SELECT, CREATE TEMPORARY TABLES ON `db`.* TO `bar`@`localhost`
show full columns in tmp;
ERROR 42S02: Table 'db.tmp' doesn't exist
disconnect con1;
connect con1,localhost,buz,,;
show columns in db.tmp;
ERROR 42000: SELECT command denied to user 'buz'@'localhost' for table `db`.`tmp`
disconnect con1;
connection default;
drop database db;
drop user foo@localhost;
drop user bar@localhost;
drop user buz@localhost;
# End of 10.3 tests
create user u1@h identified with 'mysql_native_password' using 'pwd';
ERROR HY000: Password hash should be a 41-digit hexadecimal number
@@ -209,6 +209,58 @@ show create view t_v;
--disconnect con1
drop database db1;
drop user foo@localhost;
--echo #
--echo # MDEV-28455: CREATE TEMPORARY TABLES privilege
--echo # is insufficient for SHOW COLUMNS
--echo #

create database db;
create user foo@localhost;
create user bar@localhost;
create user buz@localhost;
grant create temporary tables on db.* to foo@localhost;
grant create temporary tables on db.* to bar@localhost;

--connect (con1,localhost,foo,,db)
create temporary table tmp (a int, key(a));
show tables;
show full tables;
show table status;
show index in tmp;
show columns in tmp;
show full columns in tmp;
--echo # we don't expect to show temporary tables in information_schema.columns
select * from information_schema.columns where table_schema='db';
--disconnect con1

--connect (con1,localhost,bar,,db)
# User doesn't have `select` privilege on table
--error ER_TABLEACCESS_DENIED_ERROR
show full columns in tmp;

--disconnect con1

--connection default
grant select on db.* to bar@localhost;

--connect (con1,localhost,bar,,db)
# Table doesn't exist for this session
show grants for current_user;
--error ER_NO_SUCH_TABLE
show full columns in tmp;
--disconnect con1

--connect (con1,localhost,buz,,)
--error ER_TABLEACCESS_DENIED_ERROR
show columns in db.tmp;
--disconnect con1

--connection default
# Cleanup
drop database db;
drop user foo@localhost;
drop user bar@localhost;
drop user buz@localhost;

--echo # End of 10.3 tests

0 comments on commit 667d3fb

Please sign in to comment.