diff --git a/mysql-test/main/func_concat.result b/mysql-test/main/func_concat.result index 4303c97d35c..4b91fb97c6c 100644 --- a/mysql-test/main/func_concat.result +++ b/mysql-test/main/func_concat.result @@ -287,3 +287,20 @@ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; c2 abcdefghi,abcdefghi-abcdefghi,abcdefghi DROP TABLE t1; +# Start of 10.5 tests +# +# MDEV-13120 Wrong results with MAKE_SET() and subquery +# +CREATE TABLE t1 (a DATE, b DATETIME, c VARCHAR(8)); +INSERT INTO t1 VALUES +('1996-03-06','1985-11-16 08:00:46','foo'), +('2028-08-26','1900-01-01 00:00:00','bar'), +('1973-05-04','1900-01-01 00:00:00','qux'); +SELECT CONCAT_WS(' ', a, b, PASSWORD(c)) AS f FROM t1 GROUP BY f WITH ROLLUP; +f +1973-05-04 1900-01-01 00:00:00 *6D720C5AAB5096E70AA751206B45B484E5E0121F +1996-03-06 1985-11-16 08:00:46 *F3A2A51A9B0F2BE2468926B4132313728C250DBF +2028-08-26 1900-01-01 00:00:00 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB +NULL +DROP TABLE t1; +# End of 10.5 tests diff --git a/mysql-test/main/func_concat.test b/mysql-test/main/func_concat.test index 44dea7e35b1..f93b150f88f 100644 --- a/mysql-test/main/func_concat.test +++ b/mysql-test/main/func_concat.test @@ -265,3 +265,19 @@ CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); INSERT INTO t1 VALUES('abcdefghi'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; DROP TABLE t1; + +--echo # Start of 10.5 tests + +--echo # +--echo # MDEV-13120 Wrong results with MAKE_SET() and subquery +--echo # + +CREATE TABLE t1 (a DATE, b DATETIME, c VARCHAR(8)); +INSERT INTO t1 VALUES +('1996-03-06','1985-11-16 08:00:46','foo'), +('2028-08-26','1900-01-01 00:00:00','bar'), +('1973-05-04','1900-01-01 00:00:00','qux'); +SELECT CONCAT_WS(' ', a, b, PASSWORD(c)) AS f FROM t1 GROUP BY f WITH ROLLUP; +DROP TABLE t1; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 51a8dc94e82..bc045f08324 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5466,4 +5466,12 @@ CREATE TABLE t (f POINT, KEY(f)); DELETE FROM t WHERE f NOT IN (NULL,'x'); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field DROP TABLE t; +# +# MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor +# +CREATE TABLE t (a INT, b POINT); +INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); +SELECT NTH_VALUE(a,b) OVER () FROM t; +ERROR HY000: Illegal parameter data types point and bigint for operation '-' +DROP TABLE t; # End of 10.5 tests diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 88b9a59409d..1dd713e870a 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -3472,4 +3472,14 @@ CREATE TABLE t (f POINT, KEY(f)); DELETE FROM t WHERE f NOT IN (NULL,'x'); DROP TABLE t; +--echo # +--echo # MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor +--echo # + +CREATE TABLE t (a INT, b POINT); +INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT NTH_VALUE(a,b) OVER () FROM t; +DROP TABLE t; + --echo # End of 10.5 tests diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index eba5d4bbf9e..07a2bd174d3 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -883,76 +883,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; Warnings: Warning 1264 Out of range value for column 'a' at row 4 DROP TABLE t1; -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a) SELECT SUM(1); -INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); -INSERT INTO t1 (b) SELECT AVG('x') OVER (); -ERROR 22007: Truncated incorrect DOUBLE value: 'x' -INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; -EXECUTE stmt USING 9; -EXECUTE stmt USING 10; -PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; -EXECUTE stmt USING 11, 12; -EXECUTE stmt USING 13, 14; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -9 NULL -10 NULL -11 12 -13 14 -CREATE PROCEDURE p1(param_a INT, param_b INT) -BEGIN -INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); -END// -CALL p1(21, 22); -CALL p1(23, 24); -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -9 NULL -10 NULL -11 12 -13 14 -21 22 -23 24 -CREATE TABLE t2 ( -a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN -+ 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); -INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); -INSERT INTO t2 SELECT AVG('x') OVER ( -PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); -ERROR 22007: Truncated incorrect DOUBLE value: 'x' -INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), -('x'),((a = 'x' AND 0 AND 0)); -Warnings: -Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 2 -Warning 1062 Duplicate entry '0' for key 'a' -Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 4 -Warning 1062 Duplicate entry '0' for key 'a' -Warning 1062 Duplicate entry '0' for key 'a' -INSERT INTO t2 VALUES (127); -INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; -ERROR 23000: Duplicate entry '-2147483648' for key 'a' -ALTER TABLE t2 ADD ( -b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' -BETWEEN 'x' AND 'x'))); -ERROR 22007: Truncated incorrect DECIMAL value: 'x' -UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; -ERROR 23000: Duplicate entry '-128' for key 'a' -DROP TABLE t1, t2; -DROP PROCEDURE p1; # End of 10.2 test # # MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY @@ -1054,3 +984,52 @@ drop table t1, t2; # # End of 10.3 test # +# +# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +# +CREATE TABLE t1 (a int); +INSERT INTO t1 SELECT AVG(1); +SELECT * FROM t1; +a +1 +INSERT INTO t1 SELECT MIN(2) OVER (); +SELECT * FROM t1; +a +1 +2 +CREATE VIEW v1 AS SELECT * FROM t1 ORDER BY a; +INSERT INTO v1 SELECT SUM(3); +SELECT * FROM v1; +a +1 +2 +3 +INSERT INTO v1 SELECT * FROM v1; +SELECT * FROM t1; +a +1 +1 +2 +2 +3 +3 +INSERT INTO t1 SELECT * FROM v1; +SELECT * FROM t1; +a +1 +1 +1 +1 +2 +2 +2 +2 +3 +3 +3 +3 +DROP VIEW v1; +DROP TABLE t1; +# +# End of 10.5 test +# diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test index a3604e38f34..0e9bd05a93e 100644 --- a/mysql-test/main/insert_select.test +++ b/mysql-test/main/insert_select.test @@ -459,60 +459,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; DROP TABLE t1; -# -# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT -# -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a) SELECT SUM(1); -INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); - ---error ER_TRUNCATED_WRONG_VALUE -INSERT INTO t1 (b) SELECT AVG('x') OVER (); -INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); -SELECT * FROM t1; - -PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; -EXECUTE stmt USING 9; -EXECUTE stmt USING 10; - -PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; -EXECUTE stmt USING 11, 12; -EXECUTE stmt USING 13, 14; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; - -DELIMITER //; -CREATE PROCEDURE p1(param_a INT, param_b INT) -BEGIN -INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); -END// -DELIMITER ;// -CALL p1(21, 22); -CALL p1(23, 24); -SELECT * FROM t1; - -CREATE TABLE t2 ( - a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN - + 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); -INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); ---error ER_TRUNCATED_WRONG_VALUE -INSERT INTO t2 SELECT AVG('x') OVER ( - PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); -INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), - ('x'),((a = 'x' AND 0 AND 0)); -INSERT INTO t2 VALUES (127); ---error ER_DUP_ENTRY -INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; ---error ER_TRUNCATED_WRONG_VALUE -ALTER TABLE t2 ADD ( - b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' - BETWEEN 'x' AND 'x'))); ---error ER_DUP_ENTRY -UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; - -DROP TABLE t1, t2; -DROP PROCEDURE p1; - --echo # End of 10.2 test --echo # @@ -613,3 +559,38 @@ drop table t1, t2; --echo # --echo # End of 10.3 test --echo # + +--echo # +--echo # MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +--echo # + +CREATE TABLE t1 (a int); + +INSERT INTO t1 SELECT AVG(1); +--sorted_result +SELECT * FROM t1; + +INSERT INTO t1 SELECT MIN(2) OVER (); +--sorted_result +SELECT * FROM t1; + +CREATE VIEW v1 AS SELECT * FROM t1 ORDER BY a; + +INSERT INTO v1 SELECT SUM(3); +--sorted_result +SELECT * FROM v1; + +INSERT INTO v1 SELECT * FROM v1; +--sorted_result +SELECT * FROM t1; + +INSERT INTO t1 SELECT * FROM v1; +--sorted_result +SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # End of 10.5 test +--echo # diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index 50b542fa5fe..7bea8862c18 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -895,3 +895,46 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c2` = `test`.`t1`.`c1` drop table t1,t2; # End of 10.4 tests +# +# MDEV-35571: Connection hangs after query on a partitioned table with UNION and LIMIT ROWS EXAMINED +# +create table t1 (a int); +insert into t1 values (1), (2); +select * from t1 UNION ALL select * from t1 LIMIT ROWS EXAMINED 1; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete +select * from t1 UNION DISTINCT select * from t1 LIMIT ROWS EXAMINED 1; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete +DROP TABLE t1; +create table t1 (a int); +insert into t1 values (1), (2); +(select a from t1 UNION ALL select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete +(select a from t1 UNION DISTINCT select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 SELECT seq%25 FROM seq_1_to_100; +CREATE TABLE t2 (b INT, c INT, KEY(b)) PARTITION BY HASH(c) PARTITIONS 12; +INSERT INTO t2 SELECT seq, seq FROM seq_1_to_10; +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION ALL SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +COUNT(*) +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 100. The query result may be incomplete +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION DISTINCT SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +COUNT(*) +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 100. The query result may be incomplete +DROP TABLE t1, t2; +# End of 10.5 tests diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index 94bbf8e819a..12c75121dfb 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -617,3 +617,44 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2; drop table t1,t2; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-35571: Connection hangs after query on a partitioned table with UNION and LIMIT ROWS EXAMINED +--echo # + +--source include/have_partition.inc +--source include/have_sequence.inc + +# Simplified test +create table t1 (a int); +insert into t1 values (1), (2); +select * from t1 UNION ALL select * from t1 LIMIT ROWS EXAMINED 1; +# UNION DISTINCT produces the same result here. Note that this is not +# affected by the MDEV-35571 patch +select * from t1 UNION DISTINCT select * from t1 LIMIT ROWS EXAMINED 1; +DROP TABLE t1; + +# Simplified test with order by +create table t1 (a int); +insert into t1 values (1), (2); +(select a from t1 UNION ALL select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +# UNION DISTINCT produces the same result with order by desc. Note +# that this is not affected by the MDEV-35571 patch +(select a from t1 UNION DISTINCT select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +DROP TABLE t1; + +# Original test +CREATE TABLE t1 (a INT); +INSERT INTO t1 SELECT seq%25 FROM seq_1_to_100; + +CREATE TABLE t2 (b INT, c INT, KEY(b)) PARTITION BY HASH(c) PARTITIONS 12; +INSERT INTO t2 SELECT seq, seq FROM seq_1_to_10; + +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION ALL SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +# UNION DISTINCT produces the same result here. Note that this is not +# affected by the MDEV-35571 patch +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION DISTINCT SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; + +DROP TABLE t1, t2; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/mysqldump-system,win.rdiff b/mysql-test/main/mysqldump-system,win.rdiff index 57ce772a452..c6d8d5bd379 100644 --- a/mysql-test/main/mysqldump-system,win.rdiff +++ b/mysql-test/main/mysqldump-system,win.rdiff @@ -6,7 +6,7 @@ mysql.time_zone_transition 3895294076 -mysql.plugin 1587119305 +mysql.plugin 2184891911 - mysql.servers 2079085450 + mysql.servers 2180549486 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 347867921 @@ -18,7 +18,7 @@ mysql.time_zone_transition 3895294076 -mysql.plugin 1587119305 +mysql.plugin 2184891911 - mysql.servers 2079085450 + mysql.servers 2180549486 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 347867921 diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index d8a1283391a..1f949a27e26 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -1850,7 +1850,7 @@ Table Checksum mysql.roles_mapping 2510045525 mysql.time_zone_transition 3895294076 mysql.plugin 1587119305 -mysql.servers 2079085450 +mysql.servers 2180549486 mysql.func 3241572444 mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 @@ -1885,7 +1885,7 @@ Table Checksum mysql.roles_mapping 2510045525 mysql.time_zone_transition 3895294076 mysql.plugin 1587119305 -mysql.servers 2079085450 +mysql.servers 2180549486 mysql.func 3241572444 mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 diff --git a/mysql-test/main/secure_file_priv_win.test b/mysql-test/main/secure_file_priv_win.test index 40a7b4ea40d..bacc9fc2de1 100644 --- a/mysql-test/main/secure_file_priv_win.test +++ b/mysql-test/main/secure_file_priv_win.test @@ -13,10 +13,11 @@ LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`; LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`; --disable_ps2_protocol - +--disable_cursor_protocol #create the file --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp' FROM t1; +--enable_cursor_protocol --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR show global variables like 'secure_file_priv'; @@ -52,6 +53,7 @@ eval LOAD DATA INFILE '$MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1; --error ER_OPTION_PREVENTS_STATEMENT eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1; +--disable_cursor_protocol --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --error ER_OPTION_PREVENTS_STATEMENT eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp' FROM t1; @@ -67,6 +69,7 @@ eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp' FROM t1; --replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp' FROM t1; +--enable_cursor_protocol --error 0,1 --remove_file $MYSQL_TMP_DIR/B11764517.tmp; diff --git a/mysql-test/main/servers.result b/mysql-test/main/servers.result index c466967a0db..d660aff1bd2 100644 --- a/mysql-test/main/servers.result +++ b/mysql-test/main/servers.result @@ -24,6 +24,11 @@ SELECT * FROM mysql.servers; Server_name Host Db Username Password Port Socket Wrapper Owner s1 3306 bar mysql DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock'); +SELECT Socket FROM mysql.servers where Server_name = 's1'; +Socket +/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock +DROP SERVER s1; # # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers # diff --git a/mysql-test/main/servers.test b/mysql-test/main/servers.test index 6aaaa356c1d..1a58d5849f8 100644 --- a/mysql-test/main/servers.test +++ b/mysql-test/main/servers.test @@ -23,6 +23,10 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar'); SELECT * FROM mysql.servers; DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock'); +SELECT Socket FROM mysql.servers where Server_name = 's1'; +DROP SERVER s1; + --echo # --echo # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers --echo # diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result index bd63549a441..f15c4b866c4 100644 --- a/mysql-test/main/system_mysql_db.result +++ b/mysql-test/main/system_mysql_db.result @@ -129,7 +129,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index d580edbc961..210f1750074 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -167,7 +167,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index 10607be829a..92d16e42324 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -171,7 +171,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index 391c4e5b3f3..7a8dfcd6a5e 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -151,7 +151,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50568.result b/mysql-test/main/system_mysql_db_fix50568.result index 8f3a1ff1f31..5db0c173200 100644 --- a/mysql-test/main/system_mysql_db_fix50568.result +++ b/mysql-test/main/system_mysql_db_fix50568.result @@ -172,7 +172,7 @@ servers CREATE TABLE `servers` ( `Username` char(128) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 88a537d8c97..7a42bda43c2 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -1503,8 +1503,6 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; -insert into v3(a) select sum(302); -insert into v3(a) select sum(303) over (); select * from v3; a b 100 0 @@ -1523,14 +1521,6 @@ a b 301 10 301 1000 301 2000 -302 0 -302 10 -302 1000 -302 2000 -303 0 -303 10 -303 1000 -303 2000 drop view v3; drop tables t1,t2; create table t1(f1 int); diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index c9e8f4e97c0..55fe2aace70 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -1335,8 +1335,6 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; -insert into v3(a) select sum(302); -insert into v3(a) select sum(303) over (); --sorted_result select * from v3; diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 154eaef5a26..c45bea44c03 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -163,7 +163,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_ def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) select,insert,update,references NEVER NULL def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) PRI select,insert,update,references NEVER NULL -def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL +def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(108) select,insert,update,references NEVER NULL def mysql servers Username 4 '' NO char 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(128) select,insert,update,references NEVER NULL def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) select,insert,update,references NEVER NULL def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) select,insert,update,references NEVER NULL @@ -490,7 +490,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Username char 128 384 utf8mb3 utf8mb3_general_ci char(128) 3.0000 mysql servers Password char 64 192 utf8mb3 utf8mb3_general_ci char(64) NULL mysql servers Port int NULL NULL NULL NULL int(4) -3.0000 mysql servers Socket char 64 192 utf8mb3 utf8mb3_general_ci char(64) +3.0000 mysql servers Socket char 108 324 utf8mb3 utf8mb3_general_ci char(108) 3.0000 mysql servers Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64) 3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 9fac1a22440..a30db6bd2a5 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -149,7 +149,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_ def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) NEVER NULL def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) NEVER NULL def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) PRI NEVER NULL -def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) NEVER NULL +def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(108) NEVER NULL def mysql servers Username 4 '' NO char 128 384 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(128) NEVER NULL def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8mb3 utf8mb3_general_ci char(64) NEVER NULL def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8mb3 utf8mb3_general_ci varchar(512) NEVER NULL @@ -473,7 +473,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Username char 128 384 utf8mb3 utf8mb3_general_ci char(128) 3.0000 mysql servers Password char 64 192 utf8mb3 utf8mb3_general_ci char(64) NULL mysql servers Port int NULL NULL NULL NULL int(4) -3.0000 mysql servers Socket char 64 192 utf8mb3 utf8mb3_general_ci char(64) +3.0000 mysql servers Socket char 108 324 utf8mb3 utf8mb3_general_ci char(108) 3.0000 mysql servers Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64) 3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6) diff --git a/mysql-test/suite/galera/r/MDEV-26266.result b/mysql-test/suite/galera/r/MDEV-26266.result new file mode 100644 index 00000000000..01171d4bb83 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-26266.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +SET SESSION query_prealloc_size=8192; +SET max_session_mem_used=50000; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=InnoDB ; +UPDATE t1 SET c1='1'; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +SET wsrep_trx_fragment_size=1; +SET SESSION AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET @inserted_value=REPEAT ('z', 257); +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB ; +SELECT * FROM t1 WHERE c1='two'; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +UPDATE t1 SET c1='2'; +INSERT INTO t2 VALUES (2); +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +INSERT INTO t2 VALUES (3); +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MDEV-26266.test b/mysql-test/suite/galera/t/MDEV-26266.test new file mode 100644 index 00000000000..7167e029cb5 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-26266.test @@ -0,0 +1,35 @@ +# +# MDEV-26266 - Assertion +# state() == s_preparing || +# (is_xa() && state() == s_replaying) || +# (ret && (state() == s_must_abort || +# state() == s_must_replay || +# state() == s_cert_failed || +# state() == s_aborted)) +# failed. +# + +--source include/galera_cluster.inc + +SET SESSION query_prealloc_size=8192; +SET max_session_mem_used=50000; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=InnoDB ; +--error ER_OPTION_PREVENTS_STATEMENT +UPDATE t1 SET c1='1'; +SET wsrep_trx_fragment_size=1; +SET SESSION AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET @inserted_value=REPEAT ('z', 257); +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB ; +--error ER_OPTION_PREVENTS_STATEMENT +SELECT * FROM t1 WHERE c1='two'; +UPDATE t1 SET c1='2'; +--error ER_OPTION_PREVENTS_STATEMENT +INSERT INTO t2 VALUES (2); +INSERT INTO t2 VALUES (3); +INSERT INTO t2 VALUES (4); +INSERT INTO t2 VALUES (5); +--error ER_LOCK_DEADLOCK +CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; + +DROP TABLE t1,t2; diff --git a/mysql-test/suite/handler/handler_warnings.result b/mysql-test/suite/handler/handler_warnings.result new file mode 100644 index 00000000000..f64f7cad76f --- /dev/null +++ b/mysql-test/suite/handler/handler_warnings.result @@ -0,0 +1,14 @@ +# +# MDEV-30263: --echo # Assertion failure in Protocol::end_statement +# upon HANDLER READ with invalid timestamp +# +CREATE TABLE t (a TIMESTAMP, KEY(a)); +HANDLER t OPEN; +HANDLER t READ a > ('2022-12'); +a +# above should issue the same warnings/errors as following +SELECT * from t WHERE t.a > ('2022-12'); +a +HANDLER t CLOSE; +DROP TABLE t; +End of 10.5 tests diff --git a/mysql-test/suite/handler/handler_warnings.test b/mysql-test/suite/handler/handler_warnings.test new file mode 100644 index 00000000000..b632381c1c0 --- /dev/null +++ b/mysql-test/suite/handler/handler_warnings.test @@ -0,0 +1,15 @@ +--echo # +--echo # MDEV-30263: --echo # Assertion failure in Protocol::end_statement +--echo # upon HANDLER READ with invalid timestamp +--echo # + +CREATE TABLE t (a TIMESTAMP, KEY(a)); +HANDLER t OPEN; +HANDLER t READ a > ('2022-12'); +--echo # above should issue the same warnings/errors as following +SELECT * from t WHERE t.a > ('2022-12'); +# Cleanup +HANDLER t CLOSE; +DROP TABLE t; + +--echo End of 10.5 tests diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result index 6cd4c4991b7..84265955dc6 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze status OK # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result index d1b7a599923..5e089f2d2b5 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze note The storage engine for the table doesn't support analyze # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result index ad83e95929a..26f168e3734 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze status OK # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result index 696eb8d867b..6fafa256b77 100644 --- a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result +++ b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result @@ -32,6 +32,7 @@ insert into t1 set a = 2; insert into t1 set a = 1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size = $val; CHANGE MASTER TO master_use_gtid= no; include/start_slave.inc include/sync_with_master_gtid.inc @@ -56,6 +57,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 2, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 101 1 1 1 @@ -100,6 +102,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 1, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 100 1 1 1 @@ -146,5 +149,6 @@ connection master; DROP TABLE t1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size; include/sync_with_master_gtid.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test index 464f68723f9..cd25949c16b 100644 --- a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test +++ b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test @@ -47,6 +47,12 @@ while ($i) --source include/save_master_gtid.inc --connection slave +# enforce determistic SELECT * from mysql.gtid_slave_pos +--let $old_gtid_cleanup_batch_size = `select @@GLOBAL.gtid_cleanup_batch_size` +# the number of generated transactions on master must not exceed this value: +--let $val= 2147483647 +--evalp SET @@global.gtid_cleanup_batch_size = $val + # due to MDEV-19801 on 10+.10+ CHANGE MASTER TO master_use_gtid= no; --source include/start_slave.inc @@ -87,6 +93,7 @@ while ($i) --echo # 5. --let $rpl_server_number= 2 --source include/rpl_restart_server.inc + --evalp SET @@global.gtid_cleanup_batch_size = $val select * from mysql.gtid_slave_pos; select @@global.gtid_slave_pos as "before dump restore"; --let $dump=dump_$i.sql @@ -132,6 +139,7 @@ DROP TABLE t1; --source include/save_master_gtid.inc --connection slave +--evalp SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size --remove_files_wildcard $MYSQLTEST_VARDIR/tmp dump_*.sql --source include/sync_with_master_gtid.inc diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 2d5d5a66232..c127370e536 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%'; Variable_name Value wsrep_local_state_uuid # wsrep_protocol_version # +wsrep_protocol_application # +wsrep_protocol_replicator # +wsrep_protocol_gcs # wsrep_last_committed # wsrep_replicated # wsrep_replicated_bytes # diff --git a/mysql-test/suite/wsrep/r/variables_debug.result b/mysql-test/suite/wsrep/r/variables_debug.result index 2ce69827911..2e7e92c4395 100644 --- a/mysql-test/suite/wsrep/r/variables_debug.result +++ b/mysql-test/suite/wsrep/r/variables_debug.result @@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%'; Variable_name Value wsrep_local_state_uuid # wsrep_protocol_version # +wsrep_protocol_application # +wsrep_protocol_replicator # +wsrep_protocol_gcs # wsrep_last_committed # wsrep_replicated # wsrep_replicated_bytes # diff --git a/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result b/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result new file mode 100644 index 00000000000..35139f5b9cf --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result @@ -0,0 +1,7 @@ +# Correct Galera library found +show status like 'wsrep_protocol%'; +Variable_name Value +wsrep_protocol_application 4 +wsrep_protocol_gcs 5 +wsrep_protocol_replicator 11 +wsrep_protocol_version 11 diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index c28638e78f1..3f3363d8f26 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -3,7 +3,7 @@ --source include/have_innodb.inc --source include/galera_no_debug_sync.inc ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source include/check_galera_version.inc; source include/galera_variables_ok.inc; diff --git a/mysql-test/suite/wsrep/t/variables_debug.test b/mysql-test/suite/wsrep/t/variables_debug.test index 5e90d61c84e..4d0de10ed0a 100644 --- a/mysql-test/suite/wsrep/t/variables_debug.test +++ b/mysql-test/suite/wsrep/t/variables_debug.test @@ -5,7 +5,7 @@ --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source include/check_galera_version.inc; source include/galera_variables_ok.inc; diff --git a/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf new file mode 100644 index 00000000000..f4d5689404c --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf @@ -0,0 +1,13 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +wsrep-on=ON +binlog-format=ROW +innodb-flush-log-at-trx-commit=1 +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +innodb-autoinc-lock-mode=2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port diff --git a/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test new file mode 100644 index 00000000000..f8979050686 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test @@ -0,0 +1,9 @@ +--source include/have_wsrep.inc +--source include/force_restart.inc +--source include/have_innodb.inc + +--let $galera_version=26.4.21 +source include/check_galera_version.inc; + +--sorted_result +show status like 'wsrep_protocol%'; diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index a3f6824ceb9..25ba5101391 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci comment='MySQL plugins'; -CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(128) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8mb3 comment='MySQL Foreign Servers table'; +CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(128) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(108) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8mb3 comment='MySQL Foreign Servers table'; CREATE TABLE IF NOT EXISTS tables_priv ( Host char(255) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(128) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor varchar(384) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') COLLATE utf8mb3_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8mb3_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8mb3 COLLATE utf8mb3_bin comment='Table privileges'; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 73b72f6c822..2bedd0e26b4 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -867,3 +867,7 @@ DELIMITER ; ALTER TABLE servers MODIFY Host varchar(2048) NOT NULL DEFAULT '', MODIFY Owner varchar(512) NOT NULL DEFAULT ''; + +# MDEV-34716 Fix mysql.servers socket max length too short +ALTER TABLE servers + MODIFY Socket char(108) NOT NULL DEFAULT ''; diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 18b043f33f6..cf6838607a3 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2490,7 +2490,7 @@ String *Item_func_password::val_str_ascii(String *str) if (args[0]->null_value || res->length() == 0) return make_empty_result(str); my_make_scrambled_password(tmp_value, res->ptr(), res->length()); - str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1); + str->copy(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1); break; case OLD: if ((null_value=args[0]->null_value)) @@ -2498,7 +2498,7 @@ String *Item_func_password::val_str_ascii(String *str) if (res->length() == 0) return make_empty_result(str); my_make_scrambled_password_323(tmp_value, res->ptr(), res->length()); - str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1); + str->copy(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1); break; default: DBUG_ASSERT(0); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 45a11daebd9..e588665efef 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8093,39 +8093,6 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, DBUG_RETURN(thd->is_error()); } -/* - make list of leaves for a single TABLE_LIST - - SYNOPSIS - make_leaves_for_single_table() - thd Thread handler - leaves List of leaf tables to be filled - table TABLE_LIST object to process - full_table_list Whether to include tables from mergeable derived table/view -*/ -void make_leaves_for_single_table(THD *thd, List &leaves, - TABLE_LIST *table, bool& full_table_list, - TABLE_LIST *boundary) -{ - if (table == boundary) - full_table_list= !full_table_list; - if (full_table_list && table->is_merged_derived()) - { - SELECT_LEX *select_lex= table->get_single_select(); - /* - It's safe to use select_lex->leaf_tables because all derived - tables/views were already prepared and has their leaf_tables - set properly. - */ - make_leaves_list(thd, leaves, select_lex->get_table_list(), - full_table_list, boundary); - } - else - { - leaves.push_back(table, thd->mem_root); - } -} - /* Perform checks like all given fields exists, if exists fill struct with @@ -8152,79 +8119,40 @@ int setup_returning_fields(THD* thd, TABLE_LIST* table_list) SYNOPSIS make_leaves_list() - leaves List of leaf tables to be filled - tables Table list - full_table_list Whether to include tables from mergeable derived table/view. - We need them for checks for INSERT/UPDATE statements only. + list pointer to pointer on list first element + tables table list + full_table_list whether to include tables from mergeable derived table/view. + we need them for checks for INSERT/UPDATE statements only. + + RETURN pointer on pointer to next_leaf of last element */ -void make_leaves_list(THD *thd, List &leaves, TABLE_LIST *tables, +void make_leaves_list(THD *thd, List &list, TABLE_LIST *tables, bool full_table_list, TABLE_LIST *boundary) { for (TABLE_LIST *table= tables; table; table= table->next_local) { - make_leaves_for_single_table(thd, leaves, table, full_table_list, - boundary); + if (table == boundary) + full_table_list= !full_table_list; + if (full_table_list && table->is_merged_derived()) + { + SELECT_LEX *select_lex= table->get_single_select(); + /* + It's safe to use select_lex->leaf_tables because all derived + tables/views were already prepared and has their leaf_tables + set properly. + */ + make_leaves_list(thd, list, select_lex->get_table_list(), + full_table_list, boundary); + } + else + { + list.push_back(table, thd->mem_root); + } } } - -/* - Setup the map and other attributes for a single TABLE_LIST object - - SYNOPSIS - setup_table_attributes() - thd Thread handler - table_list TABLE_LIST object to process - first_select_table First table participating in SELECT for INSERT..SELECT - statements, NULL for other cases - tablenr Serial number of the table in the SQL statement - - RETURN - false Success - true Failure -*/ -bool setup_table_attributes(THD *thd, TABLE_LIST *table_list, - TABLE_LIST *first_select_table, - uint &tablenr) -{ - TABLE *table= table_list->table; - if (table) - table->pos_in_table_list= table_list; - if (first_select_table && table_list->top_table() == first_select_table) - { - /* new counting for SELECT of INSERT ... SELECT command */ - first_select_table= 0; - thd->lex->first_select_lex()->insert_tables= tablenr; - tablenr= 0; - } - if (table_list->jtbm_subselect) - { - table_list->jtbm_table_no= tablenr; - } - else if (table) - { - table->pos_in_table_list= table_list; - setup_table_map(table, table_list, tablenr); - - if (table_list->process_index_hints(table)) - return true; - } - tablenr++; - /* - We test the max tables here as we setup_table_map() should not be called - with tablenr >= 64 - */ - if (tablenr > MAX_TABLES) - { - my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast(MAX_TABLES)); - return true; - } - return false; -} - - /* prepare tables @@ -8281,14 +8209,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.empty(); if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) { - /* - For INSERT ... SELECT statements we must not include the first table - (where the data is being inserted into) in the list of leaves - */ - TABLE_LIST *tables_for_leaves= - select_insert ? first_select_table : tables; - make_leaves_list(thd, leaves, tables_for_leaves, full_table_list, - first_select_table); + make_leaves_list(thd, leaves, tables, full_table_list, first_select_table); select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->leaf_tables_exec.empty(); } @@ -8298,35 +8219,48 @@ bool setup_tables(THD *thd, Name_resolution_context *context, while ((table_list= ti++)) leaves.push_back(table_list, thd->mem_root); } - - List_iterator ti(leaves); + + bool is_insert_tables_num_set= false; while ((table_list= ti++)) { - if (setup_table_attributes(thd, table_list, first_select_table, tablenr)) - DBUG_RETURN(1); - } - - if (select_insert) - { - /* - The table/view in which the data is inserted must not be included into - the leaf_tables list. But we need this table/view to setup attributes - for it. So build a temporary list of leaves and setup attributes for - the tables included - */ - List leaves; - TABLE_LIST *table= tables; - - make_leaves_for_single_table(thd, leaves, table, full_table_list, - first_select_table); - - List_iterator ti(leaves); - while ((table_list= ti++)) + TABLE *table= table_list->table; + if (table) + table->pos_in_table_list= table_list; + if (select_insert && !is_insert_tables_num_set && + table_list->top_table() == first_select_table) { - if (setup_table_attributes(thd, table_list, first_select_table, - tablenr)) + /* new counting for SELECT of INSERT ... SELECT command */ + thd->lex->first_select_lex()->insert_tables= tablenr; + is_insert_tables_num_set= true; + tablenr= 0; + } + if(table_list->jtbm_subselect) + { + table_list->jtbm_table_no= tablenr; + } + else if (table) + { + table->pos_in_table_list= table_list; + setup_table_map(table, table_list, tablenr); + + if (table_list->process_index_hints(table)) DBUG_RETURN(1); } + tablenr++; + } + if (tablenr > MAX_TABLES) + { + my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); + DBUG_RETURN(1); + } + if (select_insert && !is_insert_tables_num_set) + { + /* + This happens for statements like `INSERT INTO t1 SELECT 1`, + when there are no tables in the SELECT part. + In this case all leaf tables belong to the INSERT part + */ + thd->lex->first_select_lex()->insert_tables= tablenr; } } else @@ -9204,22 +9138,13 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, if (!result && triggers) { - void *save_bulk_param= thd->bulk_param; - /* - Reset the sentinel thd->bulk_param in order not to consume the next - values of a bound array in case one of statement executed by - the trigger's body is INSERT statement. - */ - thd->bulk_param= nullptr; if (triggers->process_triggers(thd, event, TRG_ACTION_BEFORE, TRUE) || not_null_fields_have_null_values(table)) { - thd->bulk_param= save_bulk_param; return TRUE; } - thd->bulk_param= save_bulk_param; /* Re-calculate virtual fields to cater for cases when base columns are diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index af6f21ae5c9..ef5617a1c58 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -845,17 +845,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, delete_history); if (delete_record) { - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; if (!delete_history && table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; // no LIMIT / OFFSET if (returning && result->send_data(returning->item_list) < 0) @@ -886,16 +882,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (likely(!error)) { deleted++; - thd->bulk_param= nullptr; if (!delete_history && table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE)) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; if (!--limit && using_limit) { error= -1; diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index ab8e37ab3b4..a00b34a6220 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -714,7 +714,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler, MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set); int res= item->save_in_field(key_part->field, 1); dbug_tmp_restore_column_map(&table->write_set, old_map); - if (res) + if (res < 0 || thd->is_error()) return 1; } key_len+= key_part->store_length; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index b2c15397570..18944374fb2 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1103,21 +1103,12 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, } table->reset_default_fields(); - /* - Reset the sentinel thd->bulk_param in order not to consume the next - values of a bound array in case one of statement executed by - the trigger's body is INSERT statement. - */ - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; - if (unlikely(fill_record_n_invoke_before_triggers(thd, table, table-> field_to_fill(), *values, 0, TRG_EVENT_INSERT))) { - thd->bulk_param= save_bulk_param; if (values_list.elements != 1 && ! thd->is_error()) { info.records++; @@ -1126,7 +1117,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, error=1; break; } - thd->bulk_param= save_bulk_param; } /* @@ -1636,7 +1626,8 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, if (insert_into_view && !fields.elements) { thd->lex->empty_field_list_on_rset= 1; - if (!table_list->table || table_list->is_multitable()) + if (!thd->lex->first_select_lex()->leaf_tables.head()->table || + table_list->is_multitable()) { my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), table_list->view_db.str, table_list->view_name.str); @@ -3946,6 +3937,7 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res) if (sel_res) sel_res->prepare(lex->returning()->item_list, NULL); + DBUG_ASSERT(select_lex->leaf_tables.elements != 0); List_iterator ti(select_lex->leaf_tables); TABLE_LIST *table; uint insert_tables; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b89f6bda2fe..472932cf80c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1155,8 +1155,7 @@ static bool wsrep_command_no_result(char command) { return (command == COM_STMT_FETCH || command == COM_STMT_SEND_LONG_DATA || - command == COM_STMT_CLOSE || - command == COM_STMT_PREPARE); + command == COM_STMT_CLOSE); } #endif /* WITH_WSREP */ #ifndef EMBEDDED_LIBRARY @@ -2400,13 +2399,23 @@ resume: { DEBUG_SYNC(thd, "wsrep_at_dispatch_end_before_result"); } - wsrep_after_command_before_result(thd); - if (wsrep_current_error(thd) && !wsrep_command_no_result(command)) + if (thd->wsrep_cs().state() == wsrep::client_state::s_exec) { - /* todo: Pass wsrep client state current error to override */ - wsrep_override_error(thd, wsrep_current_error(thd), - wsrep_current_error_status(thd)); - WSREP_LOG_THD(thd, "leave"); + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd) && !wsrep_command_no_result(command)) + { + /* todo: Pass wsrep client state current error to override */ + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + WSREP_LOG_THD(thd, "leave"); + } + } + else + { + /* wsrep_after_command_before_result() already called elsewhere + or not necessary to call it */ + assert(thd->wsrep_cs().state() == wsrep::client_state::s_none || + thd->wsrep_cs().state() == wsrep::client_state::s_result); } if (WSREP(thd)) { diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index fd3e0589aeb..24934ce6852 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2479,6 +2479,16 @@ static bool check_prepared_statement(Prepared_statement *stmt) #ifdef WITH_WSREP if (wsrep_sync_wait(thd, sql_command)) goto error; + if (!stmt->is_sql_prepare()) + { + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd)) + { + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + goto error; + } + } #endif switch (sql_command) { case SQLCOM_REPLACE: diff --git a/sql/sql_select.cc b/sql/sql_select.cc index dd4894f8fe4..d1c19433bed 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2158,6 +2158,7 @@ JOIN::optimize_inner() /* Merge all mergeable derived tables/views in this SELECT. */ if (select_lex->handle_derived(thd->lex, DT_MERGE)) DBUG_RETURN(TRUE); + table_count= select_lex->leaf_tables.elements; } if (select_lex->first_cond_optimization && @@ -2205,6 +2206,8 @@ JOIN::optimize_inner() eval_select_list_used_tables(); + table_count= select_lex->leaf_tables.elements; + if (select_lex->options & OPTION_SCHEMA_TABLE && optimize_schema_tables_memory_usage(select_lex->leaf_tables)) DBUG_RETURN(1); @@ -15812,6 +15815,7 @@ void JOIN::cleanup(bool full) /* Free the original optimized join created for the group_by_handler */ join_tab= original_join_tab; original_join_tab= 0; + table_count= original_table_count; } if (join_tab) diff --git a/sql/sql_select.h b/sql/sql_select.h index 2888082b217..53f97d4752a 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1352,6 +1352,7 @@ public: Pushdown_query *pushdown_query; JOIN_TAB *original_join_tab; + uint original_table_count; uint sort_space; /******* Join optimization state members start *******/ diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 99843fe825a..3cb95aeacc0 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -2479,6 +2479,14 @@ bool Table_triggers_list::process_triggers(THD *thd, */ save_current_select= thd->lex->current_select; + /* + Reset the sentinel thd->bulk_param in order not to consume the next + values of a bound array in case one of statement executed by + the trigger's body is a DML statement. + */ + void *save_bulk_param= thd->bulk_param; + thd->bulk_param= nullptr; + do { thd->lex->current_select= NULL; err_status= @@ -2488,6 +2496,7 @@ bool Table_triggers_list::process_triggers(THD *thd, &trigger->subject_table_grants); status_var_increment(thd->status_var.executed_triggers); } while (!err_status && (trigger= trigger->next)); + thd->bulk_param= save_bulk_param; thd->lex->current_select= save_current_select; thd->restore_sub_statement_state(&statement_state); diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 3413b8401dc..2a6384a8897 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1026,7 +1026,8 @@ bool select_union_direct::send_eof() // Reset for each SELECT_LEX, so accumulate here limit_found_rows+= thd->limit_found_rows; - if (unit->thd->lex->current_select == last_select_lex) + if (unit->thd->lex->current_select == last_select_lex || + thd->killed == ABORT_QUERY) { thd->limit_found_rows= limit_found_rows; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 82742a91af0..8ff38c10af0 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1181,19 +1181,14 @@ error: rows_inserted++; } - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; - if (table->triggers && unlikely(table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE))) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; if (!--limit && using_limit) { diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 42fefe3ce21..09605c6921f 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2524,7 +2524,7 @@ Frame_cursor *get_frame_cursor(THD *thd, Window_spec *spec, bool is_top_bound) } static -void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, +bool add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, Item_window_func *window_func) { Window_spec *spec= window_func->window_spec; @@ -2611,7 +2611,9 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, Item *offset_func= new (thd->mem_root) Item_func_minus(thd, item_sum->get_arg(1), int_item); - offset_func->fix_fields(thd, &offset_func); + if (offset_func->fix_fields(thd, &offset_func)) + return true; + fc= new Frame_positional_cursor(*top_bound, *top_bound, *bottom_bound, *offset_func, false); @@ -2644,6 +2646,7 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, fc->add_sum_func(item_sum); cursor_manager->add_cursor(fc); } + return false; } @@ -2671,7 +2674,7 @@ static bool is_computed_with_remove(Item_sum::Sumfunctype sum_func) If the window functions share the same frame specification, those window functions will be registered to the same cursor. */ -void get_window_functions_required_cursors( +bool get_window_functions_required_cursors( THD *thd, List& window_functions, List *cursor_managers) @@ -2722,7 +2725,8 @@ void get_window_functions_required_cursors( if (item_win_func->is_frame_prohibited() || item_win_func->requires_special_cursors()) { - add_special_frame_cursors(thd, cursor_manager, item_win_func); + if (add_special_frame_cursors(thd, cursor_manager, item_win_func)) + return true; cursor_managers->push_back(cursor_manager); continue; } @@ -2756,6 +2760,7 @@ void get_window_functions_required_cursors( } cursor_managers->push_back(cursor_manager); } + return false; } /** @@ -3031,8 +3036,9 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result) it.rewind(); List cursor_managers; - get_window_functions_required_cursors(thd, window_functions, - &cursor_managers); + if (get_window_functions_required_cursors(thd, window_functions, + &cursor_managers)) + return true; /* Go through the sorted array and compute the window function */ bool is_error= compute_window_func(thd, diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index c30b522e20c..9ce29f05516 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1603,35 +1603,7 @@ bool wsrep_sync_wait (THD* thd, uint mask) This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0 TODO: modify to check if thd has locked any rows. */ - if (thd->wsrep_cs().sync_wait(-1)) - { - const char* msg; - int err; - - /* - Possibly relevant error codes: - ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY, - ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET, - ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED - */ - - switch (thd->wsrep_cs().current_error()) - { - case wsrep::e_not_supported_error: - msg= "synchronous reads by wsrep backend. " - "Please unset wsrep_causal_reads variable."; - err= ER_NOT_SUPPORTED_YET; - break; - default: - msg= "Synchronous wait failed."; - err= ER_LOCK_WAIT_TIMEOUT; // NOTE: the above msg won't be displayed - // with ER_LOCK_WAIT_TIMEOUT - } - - my_error(err, MYF(0), msg); - - return true; - } + return thd->wsrep_cs().sync_wait(-1); } return false; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 73c9dcb65d0..0758e5e2dd6 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3645,24 +3645,12 @@ retry: } else { - auto state= bpage->state(); - ut_ad(state >= buf_page_t::FREED); - ut_ad(state < buf_page_t::READ_FIX); - page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); /* It does not make sense to use transactional_lock_guard here, because buf_relocate() would likely make the memory transaction too large. */ hash_lock.lock(); - if (state < buf_page_t::UNFIXED) - bpage->set_reinit(buf_page_t::FREED); - else - { - bpage->set_reinit(state & buf_page_t::LRU_MASK); - ibuf_exist= (state & buf_page_t::LRU_MASK) == buf_page_t::IBUF_EXIST; - } - mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_relocate(bpage, &free_block->page); free_block->page.lock.x_lock(); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 36c35af1a20..607b074532f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3005,7 +3005,10 @@ static int innobase_rollback_by_xid(handlerton*, XID *xid) noexcept return XAER_RMFAIL; if (trx_t *trx= trx_get_trx_by_xid(xid)) { - ut_ad(trx->xid.is_null()); /* should have been cleared by the lookup */ + /* Lookup by xid clears the transaction xid. + For wsrep we clear it below. */ + ut_ad(trx->xid.is_null() || wsrep_is_wsrep_xid(&trx->xid)); + trx->xid.null(); trx_deregister_from_2pc(trx); THD* thd= trx->mysql_thd; dberr_t err= trx_rollback_for_mysql(trx); diff --git a/storage/spider/mysql-test/spider/r/alter_server.result b/storage/spider/mysql-test/spider/r/alter_server.result new file mode 100644 index 00000000000..19255f3cdf8 --- /dev/null +++ b/storage/spider/mysql-test/spider/r/alter_server.result @@ -0,0 +1,29 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +select Socket from mysql.servers where Server_name = "srv"; +Socket +/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock +create table t2 (c int); +alter SERVER srv OPTIONS (DATABASE 'test'); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1), (2), (3); +select * from t1; +c +1 +2 +3 +select * from t2; +c +1 +2 +3 +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/t/alter_server.cnf b/storage/spider/mysql-test/spider/t/alter_server.cnf new file mode 100644 index 00000000000..69672af4ef6 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/alter_server.cnf @@ -0,0 +1,5 @@ +[mysqld.1.1] +socket= /tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock + +[ENV] +MASTER_1_MYSOCK= @mysqld.1.1.socket diff --git a/storage/spider/mysql-test/spider/t/alter_server.test b/storage/spider/mysql-test/spider/t/alter_server.test new file mode 100644 index 00000000000..10228e785cb --- /dev/null +++ b/storage/spider/mysql-test/spider/t/alter_server.test @@ -0,0 +1,27 @@ +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +set spider_same_server_link= 1; + +# Test long socket length +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +select Socket from mysql.servers where Server_name = "srv"; +create table t2 (c int); +# triggers a table read into the server object +alter SERVER srv OPTIONS (DATABASE 'test'); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1), (2), (3); +select * from t1; +select * from t2; +drop table t1, t2; +drop server srv; + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 95ac1d50e81..f7cbb507e35 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -894,6 +894,27 @@ int my_fprintf(FILE *stream, const char* format, ...) } +#ifdef __APPLE__ +/* Delete the ':' character added by Apple's implementation of strerror_r */ +static void delete_colon_char(char *buf) +{ + static const char *unknown_err= "Unknown error"; + static const size_t unknown_err_len= 13; + char *ptr= strstr(buf, unknown_err); + char *src= NULL; + if (ptr) { + ptr+= unknown_err_len; + if (*ptr == ':') { + // just overwrite the colon by shifting everything down by one, + // e.g. "Unknown error: 1000" becomes "Unknown error 1000" + src= ptr + 1; + memmove(ptr, src, strlen(src) + 1); // include null + } + } +} +#endif + + /* Return system error text for given error number @@ -947,6 +968,10 @@ const char* my_strerror(char *buf, size_t len, int nr) #else strerror_r(nr, buf, len); #endif + +#ifdef __APPLE__ + delete_colon_char(buf); +#endif } /* diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 28d5dfb392e..5e8ec0701ff 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -22506,6 +22506,129 @@ static void test_mdev_34718_ad() rc= mysql_query(mysql, "DROP TABLE t1, t2"); myquery(rc); } + +/* Test case for bulk INSERT in presence of AFTER INSERT trigger */ +static void test_mdev_34958() +{ + int rc; + MYSQL_STMT *stmt_insert; + MYSQL_BIND bind[2]; + MYSQL_RES *result; + MYSQL_ROW row; + my_ulonglong row_count; + unsigned int vals[] = { 1, 2, 3}; + unsigned int vals_array_len = 3; + const char *insert_stmt= "INSERT INTO t1 VALUES (?)"; + + /* Set up test's environment */ + rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t2 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TRIGGER t1_ai AFTER INSERT ON t1 " + "FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);"); + + stmt_insert = mysql_stmt_init(mysql); + if (!stmt_insert) + { + fprintf(stderr, "mysql_stmt_init failed: Error: %s\n", + mysql_error(mysql)); + exit(1); + } + + rc= mysql_stmt_prepare(stmt_insert, insert_stmt, strlen(insert_stmt)); + if (rc) + { + fprintf(stderr, "mysql_stmt_prepare failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + memset(&bind[0], 0, sizeof(MYSQL_BIND)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= vals; + + rc= mysql_stmt_attr_set(stmt_insert, STMT_ATTR_ARRAY_SIZE, &vals_array_len); + if (rc) + { + fprintf(stderr, "mysql_stmt_prepare failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + rc= mysql_stmt_bind_param(stmt_insert, bind); + if (rc) + { + fprintf(stderr, "mysql_stmt_bind_param failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + rc= mysql_stmt_execute(stmt_insert); + if (rc) + { + fprintf(stderr, "mysql_stmt_execute failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + /* + It's expected that the INSERT statement adds three rows into + the table t1 + */ + row_count = mysql_stmt_affected_rows(stmt_insert); + if (row_count != 3) + { + fprintf(stderr, "Wrong number of affected rows (%llu), expected 3\n", + row_count); + exit(1); + } + + /* + * Check that the AFTER INSERT trigger of the table t1 does work correct + * and inserted the rows (1), (2), (3) into the table t2. + */ + rc= mysql_query(mysql, "SELECT 't1' tname, a FROM t1 " + "UNION SELECT 't2' tname, a FROM t2 ORDER BY tname, a"); + if (rc) + { + fprintf(stderr, "Query failed: %s\n", mysql_error(mysql)); + } + + result= mysql_store_result(mysql); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 1); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 2); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 1); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 2); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(row == NULL); + + mysql_free_result(result); + + mysql_stmt_close(stmt_insert); + + /* Clean up */ + rc= mysql_query(mysql, "DROP TABLE t1, t2"); + myquery(rc); +} #endif // EMBEDDED_LIBRARY /* @@ -23080,6 +23203,7 @@ static struct my_tests_st my_tests[]= { { "test_mdev_34718_au", test_mdev_34718_au }, { "test_mdev_34718_bd", test_mdev_34718_bd }, { "test_mdev_34718_ad", test_mdev_34718_ad }, + { "test_mdev_34958", test_mdev_34958 }, #endif { "test_mdev_10075", test_mdev_10075}, { 0, 0 } diff --git a/wsrep-lib b/wsrep-lib index 1c61b809d1e..70cd967f5e2 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 1c61b809d1e1d03771dcad689d3a084e17c6b6c3 +Subproject commit 70cd967f5e249b53d6cce90e2e4198641c564381