1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.6 into 10.11

This commit is contained in:
Marko Mäkelä
2025-01-02 12:39:56 +02:00
62 changed files with 797 additions and 449 deletions

View File

@@ -287,3 +287,20 @@ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub;
c2 c2
abcdefghi,abcdefghi-abcdefghi,abcdefghi abcdefghi,abcdefghi-abcdefghi,abcdefghi
DROP TABLE t1; 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

View File

@@ -265,3 +265,19 @@ CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi'); INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub;
DROP TABLE t1; 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

View File

@@ -5466,4 +5466,12 @@ CREATE TABLE t (f POINT, KEY(f));
DELETE FROM t WHERE f NOT IN (NULL,'x'); DELETE FROM t WHERE f NOT IN (NULL,'x');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t; 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 # End of 10.5 tests

View File

@@ -3472,4 +3472,14 @@ CREATE TABLE t (f POINT, KEY(f));
DELETE FROM t WHERE f NOT IN (NULL,'x'); DELETE FROM t WHERE f NOT IN (NULL,'x');
DROP TABLE t; 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 --echo # End of 10.5 tests

View File

@@ -883,76 +883,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
Warnings: Warnings:
Warning 1264 Out of range value for column 'a' at row 4 Warning 1264 Out of range value for column 'a' at row 4
DROP TABLE t1; 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 # End of 10.2 test
# #
# MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY # MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY
@@ -1054,3 +984,52 @@ drop table t1, t2;
# #
# End of 10.3 test # 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
#

View File

@@ -459,60 +459,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
DROP TABLE t1; 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 # End of 10.2 test
--echo # --echo #
@@ -613,3 +559,38 @@ drop table t1, t2;
--echo # --echo #
--echo # End of 10.3 test --echo # End of 10.3 test
--echo # --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 #

View File

@@ -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` 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; drop table t1,t2;
# End of 10.4 tests # 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

View File

@@ -617,3 +617,44 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2;
drop table t1,t2; drop table t1,t2;
--echo # End of 10.4 tests --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

View File

@@ -6,7 +6,7 @@
mysql.time_zone_transition 3895294076 mysql.time_zone_transition 3895294076
-mysql.plugin 1587119305 -mysql.plugin 1587119305
+mysql.plugin 2184891911 +mysql.plugin 2184891911
mysql.servers 2079085450 mysql.servers 2180549486
-mysql.func 3241572444 -mysql.func 3241572444
+mysql.func 310494789 +mysql.func 310494789
mysql.innodb_table_stats 347867921 mysql.innodb_table_stats 347867921
@@ -18,7 +18,7 @@
mysql.time_zone_transition 3895294076 mysql.time_zone_transition 3895294076
-mysql.plugin 1587119305 -mysql.plugin 1587119305
+mysql.plugin 2184891911 +mysql.plugin 2184891911
mysql.servers 2079085450 mysql.servers 2180549486
-mysql.func 3241572444 -mysql.func 3241572444
+mysql.func 310494789 +mysql.func 310494789
mysql.innodb_table_stats 347867921 mysql.innodb_table_stats 347867921

View File

@@ -1850,7 +1850,7 @@ Table Checksum
mysql.roles_mapping 2510045525 mysql.roles_mapping 2510045525
mysql.time_zone_transition 3895294076 mysql.time_zone_transition 3895294076
mysql.plugin 1587119305 mysql.plugin 1587119305
mysql.servers 2079085450 mysql.servers 2180549486
mysql.func 3241572444 mysql.func 3241572444
mysql.innodb_table_stats 347867921 mysql.innodb_table_stats 347867921
mysql.table_stats 664320059 mysql.table_stats 664320059
@@ -1885,7 +1885,7 @@ Table Checksum
mysql.roles_mapping 2510045525 mysql.roles_mapping 2510045525
mysql.time_zone_transition 3895294076 mysql.time_zone_transition 3895294076
mysql.plugin 1587119305 mysql.plugin 1587119305
mysql.servers 2079085450 mysql.servers 2180549486
mysql.func 3241572444 mysql.func 3241572444
mysql.innodb_table_stats 347867921 mysql.innodb_table_stats 347867921
mysql.table_stats 664320059 mysql.table_stats 664320059

View File

@@ -13,10 +13,11 @@ LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`;
LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`; LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`;
--disable_ps2_protocol --disable_ps2_protocol
--disable_cursor_protocol
#create the file #create the file
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp' FROM t1; eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp' FROM t1;
--enable_cursor_protocol
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
show global variables like 'secure_file_priv'; 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 --error ER_OPTION_PREVENTS_STATEMENT
eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1; eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1;
--disable_cursor_protocol
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--error ER_OPTION_PREVENTS_STATEMENT --error ER_OPTION_PREVENTS_STATEMENT
eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp' FROM t1; 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 --replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE
eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp' FROM t1; eval SELECT * INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp' FROM t1;
--enable_cursor_protocol
--error 0,1 --error 0,1
--remove_file $MYSQL_TMP_DIR/B11764517.tmp; --remove_file $MYSQL_TMP_DIR/B11764517.tmp;

View File

@@ -24,6 +24,11 @@ SELECT * FROM mysql.servers;
Server_name Host Db Username Password Port Socket Wrapper Owner Server_name Host Db Username Password Port Socket Wrapper Owner
s1 3306 bar mysql s1 3306 bar mysql
DROP SERVER s1; 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 # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers
# #

View File

@@ -23,6 +23,10 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar');
SELECT * FROM mysql.servers; SELECT * FROM mysql.servers;
DROP SERVER s1; 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 #
--echo # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers --echo # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers
--echo # --echo #

View File

@@ -129,7 +129,7 @@ servers CREATE TABLE `servers` (
`Username` char(128) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0, `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 '', `Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`) PRIMARY KEY (`Server_name`)

View File

@@ -167,7 +167,7 @@ servers CREATE TABLE `servers` (
`Username` char(128) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0, `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 '', `Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`) PRIMARY KEY (`Server_name`)

View File

@@ -171,7 +171,7 @@ servers CREATE TABLE `servers` (
`Username` char(128) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0, `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 '', `Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`) PRIMARY KEY (`Server_name`)

View File

@@ -151,7 +151,7 @@ servers CREATE TABLE `servers` (
`Username` char(128) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0, `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 '', `Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`) PRIMARY KEY (`Server_name`)

View File

@@ -172,7 +172,7 @@ servers CREATE TABLE `servers` (
`Username` char(128) NOT NULL DEFAULT '', `Username` char(128) NOT NULL DEFAULT '',
`Password` char(64) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '',
`Port` int(4) NOT NULL DEFAULT 0, `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 '', `Wrapper` char(64) NOT NULL DEFAULT '',
`Owner` varchar(512) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '',
PRIMARY KEY (`Server_name`) PRIMARY KEY (`Server_name`)

View File

@@ -1503,8 +1503,6 @@ execute stmt1 using @a;
set @a= 301; set @a= 301;
execute stmt1 using @a; execute stmt1 using @a;
deallocate prepare stmt1; deallocate prepare stmt1;
insert into v3(a) select sum(302);
insert into v3(a) select sum(303) over ();
select * from v3; select * from v3;
a b a b
100 0 100 0
@@ -1523,14 +1521,6 @@ a b
301 10 301 10
301 1000 301 1000
301 2000 301 2000
302 0
302 10
302 1000
302 2000
303 0
303 10
303 1000
303 2000
drop view v3; drop view v3;
drop tables t1,t2; drop tables t1,t2;
create table t1(f1 int); create table t1(f1 int);

View File

@@ -1335,8 +1335,6 @@ execute stmt1 using @a;
set @a= 301; set @a= 301;
execute stmt1 using @a; execute stmt1 using @a;
deallocate prepare stmt1; deallocate prepare stmt1;
insert into v3(a) select sum(302);
insert into v3(a) select sum(303) over ();
--sorted_result --sorted_result
select * from v3; select * from v3;

View File

@@ -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 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 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 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 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 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 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 Username char 128 384 utf8mb3 utf8mb3_general_ci char(128)
3.0000 mysql servers Password char 64 192 utf8mb3 utf8mb3_general_ci char(64) 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) 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 Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64)
3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) 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) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6)

View File

@@ -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 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 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 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 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 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 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 Username char 128 384 utf8mb3 utf8mb3_general_ci char(128)
3.0000 mysql servers Password char 64 192 utf8mb3 utf8mb3_general_ci char(64) 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) 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 Wrapper char 64 192 utf8mb3 utf8mb3_general_ci char(64)
3.0000 mysql servers Owner varchar 512 1536 utf8mb3 utf8mb3_general_ci varchar(512) 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) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = InnoDB, (PARTITION `parta` ENGINE = InnoDB,
PARTITION `partB` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB,
@@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = InnoDB, (PARTITION `parta` ENGINE = InnoDB,
PARTITION `partB` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB,
@@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = InnoDB, (PARTITION `parta` ENGINE = InnoDB,
PARTITION `partB` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB,
@@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB;
Table Create Table Table Create Table
TableB CREATE TABLE `TableB` ( TableB CREATE TABLE `TableB` (
`a` int(11) DEFAULT NULL `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'; 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 PARTITION_NAME HAVE_TABLE_ROWS
parta NO parta NO
@@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = InnoDB, (PARTITION `parta` ENGINE = InnoDB,
PARTITION `partB` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB,
@@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB,
@@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea;
Table Create Table Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB,
@@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after KEY PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 2.0 HASH partitioning mgm # 2.0 HASH partitioning mgm
@@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `parta` ENGINE = InnoDB, (PARTITION `parta` ENGINE = InnoDB,
PARTITION `partB` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB,
@@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `parta` ENGINE = InnoDB, (PARTITION `parta` ENGINE = InnoDB,
PARTITION `partB` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB,
@@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB,
@@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea;
Table Create Table Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB,
@@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after HASH PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 3.0 RANGE partitioning mgm # 3.0 RANGE partitioning mgm
@@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB,
PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB,
@@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB,
PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB,
@@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB,
PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' 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 Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB,
PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' 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 Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after RANGE PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 4.0 LIST partitioning mgm # 4.0 LIST partitioning mgm
@@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB,
PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB,
@@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB,
PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB,
@@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, (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, 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 Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, (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, 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 Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after LIST PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# Testing TRUNCATE PARTITION # Testing TRUNCATE PARTITION
@@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` (
`a` bigint(20) NOT NULL AUTO_INCREMENT, `a` bigint(20) NOT NULL AUTO_INCREMENT,
`b` varchar(255) DEFAULT NULL, `b` varchar(255) DEFAULT NULL,
PRIMARY KEY (`a`) 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 BY RANGE (`a`)
(PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB, (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB,
PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB,
@@ -987,7 +987,6 @@ a b
2001 Second in MAX 2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX; ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK mysql_test_db.t1 analyze status OK
# Truncate without FLUSH # Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX; ALTER TABLE t1 TRUNCATE PARTITION MAX;

View File

@@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MEMORY, (PARTITION `parta` ENGINE = MEMORY,
PARTITION `partB` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY,
@@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MEMORY, (PARTITION `parta` ENGINE = MEMORY,
PARTITION `partB` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY,
@@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MEMORY, (PARTITION `parta` ENGINE = MEMORY,
PARTITION `partB` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY,
@@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB;
Table Create Table Table Create Table
TableB CREATE TABLE `TableB` ( TableB CREATE TABLE `TableB` (
`a` int(11) DEFAULT NULL `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'; 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 PARTITION_NAME HAVE_TABLE_ROWS
parta NO parta NO
@@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MEMORY, (PARTITION `parta` ENGINE = MEMORY,
PARTITION `partB` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY,
@@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY,
@@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea;
Table Create Table Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY,
@@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after KEY PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 2.0 HASH partitioning mgm # 2.0 HASH partitioning mgm
@@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `parta` ENGINE = MEMORY, (PARTITION `parta` ENGINE = MEMORY,
PARTITION `partB` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY,
@@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `parta` ENGINE = MEMORY, (PARTITION `parta` ENGINE = MEMORY,
PARTITION `partB` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY,
@@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY,
@@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea;
Table Create Table Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY,
@@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after HASH PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 3.0 RANGE partitioning mgm # 3.0 RANGE partitioning mgm
@@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY,
PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY,
@@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY,
PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY,
@@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY,
PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' 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 Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY,
PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' 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 Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after RANGE PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 4.0 LIST partitioning mgm # 4.0 LIST partitioning mgm
@@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY,
PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY,
@@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY,
PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY,
@@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, (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, 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 Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, (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, 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 Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after LIST PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# Testing TRUNCATE PARTITION # Testing TRUNCATE PARTITION
@@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` (
`a` bigint(20) NOT NULL AUTO_INCREMENT, `a` bigint(20) NOT NULL AUTO_INCREMENT,
`b` varchar(255) DEFAULT NULL, `b` varchar(255) DEFAULT NULL,
PRIMARY KEY (`a`) 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 BY RANGE (`a`)
(PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY, (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY,
PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY,
@@ -987,7 +987,6 @@ a b
2001 Second in MAX 2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX; ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text 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 mysql_test_db.t1 analyze note The storage engine for the table doesn't support analyze
# Truncate without FLUSH # Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX; ALTER TABLE t1 TRUNCATE PARTITION MAX;

View File

@@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MyISAM, (PARTITION `parta` ENGINE = MyISAM,
PARTITION `partB` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM,
@@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MyISAM, (PARTITION `parta` ENGINE = MyISAM,
PARTITION `partB` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM,
@@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MyISAM, (PARTITION `parta` ENGINE = MyISAM,
PARTITION `partB` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM,
@@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB;
Table Create Table Table Create Table
TableB CREATE TABLE `TableB` ( TableB CREATE TABLE `TableB` (
`a` int(11) DEFAULT NULL `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'; 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 PARTITION_NAME HAVE_TABLE_ROWS
parta NO parta NO
@@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `parta` ENGINE = MyISAM, (PARTITION `parta` ENGINE = MyISAM,
PARTITION `partB` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM,
@@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM,
@@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea;
Table Create Table Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY KEY (`a`) PARTITION BY KEY (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM,
@@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after KEY PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 2.0 HASH partitioning mgm # 2.0 HASH partitioning mgm
@@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `parta` ENGINE = MyISAM, (PARTITION `parta` ENGINE = MyISAM,
PARTITION `partB` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM,
@@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `parta` ENGINE = MyISAM, (PARTITION `parta` ENGINE = MyISAM,
PARTITION `partB` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM,
@@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM,
@@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea;
Table Create Table Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY HASH (`a`) PARTITION BY HASH (`a`)
(PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM,
PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM,
@@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after HASH PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 3.0 RANGE partitioning mgm # 3.0 RANGE partitioning mgm
@@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM,
PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM,
@@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM,
PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM,
@@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM,
PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' 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 Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY RANGE (`a`) PARTITION BY RANGE (`a`)
(PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM,
PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' 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 Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after RANGE PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# 4.0 LIST partitioning mgm # 4.0 LIST partitioning mgm
@@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM,
PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM,
@@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM,
PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM,
@@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA;
Table Create Table Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, (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, 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 Table Create Table
tablea CREATE TABLE `tablea` ( tablea CREATE TABLE `tablea` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
PARTITION BY LIST (`a`) PARTITION BY LIST (`a`)
(PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, (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, 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 Table Create Table
TableA CREATE TABLE `TableA` ( TableA CREATE TABLE `TableA` (
`a` int(11) DEFAULT NULL `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 # Cleaning up after LIST PARTITIONING test
DROP TABLE TableA; DROP TABLE TableA;
# Testing TRUNCATE PARTITION # Testing TRUNCATE PARTITION
@@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` (
`a` bigint(20) NOT NULL AUTO_INCREMENT, `a` bigint(20) NOT NULL AUTO_INCREMENT,
`b` varchar(255) DEFAULT NULL, `b` varchar(255) DEFAULT NULL,
PRIMARY KEY (`a`) 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 BY RANGE (`a`)
(PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM, (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM,
PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM,
@@ -987,7 +987,6 @@ a b
2001 Second in MAX 2001 Second in MAX
ALTER TABLE t1 ANALYZE PARTITION MAX; ALTER TABLE t1 ANALYZE PARTITION MAX;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
mysql_test_db.t1 analyze status Engine-independent statistics collected
mysql_test_db.t1 analyze status OK mysql_test_db.t1 analyze status OK
# Truncate without FLUSH # Truncate without FLUSH
ALTER TABLE t1 TRUNCATE PARTITION MAX; ALTER TABLE t1 TRUNCATE PARTITION MAX;

View File

@@ -32,6 +32,7 @@ insert into t1 set a = 2;
insert into t1 set a = 1; insert into t1 set a = 1;
include/save_master_gtid.inc include/save_master_gtid.inc
connection slave; connection slave;
SET @@global.gtid_cleanup_batch_size = $val;
CHANGE MASTER TO master_use_gtid= no; CHANGE MASTER TO master_use_gtid= no;
include/start_slave.inc include/start_slave.inc
include/sync_with_master_gtid.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); insert into mysql.gtid_slave_pos values (99 + 2, 1, 1, 1);
# 5. # 5.
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
SET @@global.gtid_cleanup_batch_size = $val;
select * from mysql.gtid_slave_pos; select * from mysql.gtid_slave_pos;
domain_id sub_id server_id seq_no domain_id sub_id server_id seq_no
101 1 1 1 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); insert into mysql.gtid_slave_pos values (99 + 1, 1, 1, 1);
# 5. # 5.
include/rpl_restart_server.inc [server_number=2] include/rpl_restart_server.inc [server_number=2]
SET @@global.gtid_cleanup_batch_size = $val;
select * from mysql.gtid_slave_pos; select * from mysql.gtid_slave_pos;
domain_id sub_id server_id seq_no domain_id sub_id server_id seq_no
100 1 1 1 100 1 1 1
@@ -146,5 +149,6 @@ connection master;
DROP TABLE t1; DROP TABLE t1;
include/save_master_gtid.inc include/save_master_gtid.inc
connection slave; connection slave;
SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size;
include/sync_with_master_gtid.inc include/sync_with_master_gtid.inc
include/rpl_end.inc include/rpl_end.inc

View File

@@ -47,6 +47,12 @@ while ($i)
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
--connection slave --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+ # due to MDEV-19801 on 10+.10+
CHANGE MASTER TO master_use_gtid= no; CHANGE MASTER TO master_use_gtid= no;
--source include/start_slave.inc --source include/start_slave.inc
@@ -87,6 +93,7 @@ while ($i)
--echo # 5. --echo # 5.
--let $rpl_server_number= 2 --let $rpl_server_number= 2
--source include/rpl_restart_server.inc --source include/rpl_restart_server.inc
--evalp SET @@global.gtid_cleanup_batch_size = $val
select * from mysql.gtid_slave_pos; select * from mysql.gtid_slave_pos;
select @@global.gtid_slave_pos as "before dump restore"; select @@global.gtid_slave_pos as "before dump restore";
--let $dump=dump_$i.sql --let $dump=dump_$i.sql
@@ -132,6 +139,7 @@ DROP TABLE t1;
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
--connection slave --connection slave
--evalp SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size
--remove_files_wildcard $MYSQLTEST_VARDIR/tmp dump_*.sql --remove_files_wildcard $MYSQLTEST_VARDIR/tmp dump_*.sql
--source include/sync_with_master_gtid.inc --source include/sync_with_master_gtid.inc

View File

@@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%';
Variable_name Value Variable_name Value
wsrep_local_state_uuid # wsrep_local_state_uuid #
wsrep_protocol_version # wsrep_protocol_version #
wsrep_protocol_application #
wsrep_protocol_replicator #
wsrep_protocol_gcs #
wsrep_last_committed # wsrep_last_committed #
wsrep_replicated # wsrep_replicated #
wsrep_replicated_bytes # wsrep_replicated_bytes #

View File

@@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%';
Variable_name Value Variable_name Value
wsrep_local_state_uuid # wsrep_local_state_uuid #
wsrep_protocol_version # wsrep_protocol_version #
wsrep_protocol_application #
wsrep_protocol_replicator #
wsrep_protocol_gcs #
wsrep_last_committed # wsrep_last_committed #
wsrep_replicated # wsrep_replicated #
wsrep_replicated_bytes # wsrep_replicated_bytes #

View File

@@ -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

View File

@@ -3,7 +3,7 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/galera_no_debug_sync.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/check_galera_version.inc;
source include/galera_variables_ok.inc; source include/galera_variables_ok.inc;

View File

@@ -5,7 +5,7 @@
--source include/have_debug_sync.inc --source include/have_debug_sync.inc
--source include/galera_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/check_galera_version.inc;
source include/galera_variables_ok.inc; source include/galera_variables_ok.inc;

View File

@@ -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

View File

@@ -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%';

View File

@@ -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 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'; 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';

View File

@@ -867,3 +867,7 @@ DELIMITER ;
ALTER TABLE servers ALTER TABLE servers
MODIFY Host varchar(2048) NOT NULL DEFAULT '', MODIFY Host varchar(2048) NOT NULL DEFAULT '',
MODIFY Owner varchar(512) 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 '';

View File

@@ -2490,7 +2490,7 @@ String *Item_func_password::val_str_ascii(String *str)
if (args[0]->null_value || res->length() == 0) if (args[0]->null_value || res->length() == 0)
return make_empty_result(str); return make_empty_result(str);
my_make_scrambled_password(tmp_value, res->ptr(), res->length()); 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; break;
case OLD: case OLD:
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
@@ -2498,7 +2498,7 @@ String *Item_func_password::val_str_ascii(String *str)
if (res->length() == 0) if (res->length() == 0)
return make_empty_result(str); return make_empty_result(str);
my_make_scrambled_password_323(tmp_value, res->ptr(), res->length()); 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; break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);

View File

@@ -8093,39 +8093,6 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
DBUG_RETURN(thd->is_error()); 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<TABLE_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 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 SYNOPSIS
make_leaves_list() make_leaves_list()
leaves List of leaf tables to be filled list pointer to pointer on list first element
tables Table list tables table list
full_table_list Whether to include tables from mergeable derived table/view. full_table_list whether to include tables from mergeable derived table/view.
We need them for checks for INSERT/UPDATE statements only. 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<TABLE_LIST> &leaves, TABLE_LIST *tables, void make_leaves_list(THD *thd, List<TABLE_LIST> &list, TABLE_LIST *tables,
bool full_table_list, TABLE_LIST *boundary) bool full_table_list, TABLE_LIST *boundary)
{ {
for (TABLE_LIST *table= tables; table; table= table->next_local) for (TABLE_LIST *table= tables; table; table= table->next_local)
{ {
make_leaves_for_single_table(thd, leaves, table, full_table_list, if (table == boundary)
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<int>(MAX_TABLES));
return true;
}
return false;
}
/* /*
prepare tables prepare tables
@@ -8281,14 +8209,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
leaves.empty(); leaves.empty();
if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED)
{ {
/* make_leaves_list(thd, leaves, tables, full_table_list, first_select_table);
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);
select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->prep_leaf_list_state= SELECT_LEX::READY;
select_lex->leaf_tables_exec.empty(); select_lex->leaf_tables_exec.empty();
} }
@@ -8298,35 +8219,48 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
while ((table_list= ti++)) while ((table_list= ti++))
leaves.push_back(table_list, thd->mem_root); leaves.push_back(table_list, thd->mem_root);
} }
List_iterator<TABLE_LIST> ti(leaves); bool is_insert_tables_num_set= false;
while ((table_list= ti++)) while ((table_list= ti++))
{ {
if (setup_table_attributes(thd, table_list, first_select_table, tablenr)) TABLE *table= table_list->table;
DBUG_RETURN(1); if (table)
} table->pos_in_table_list= table_list;
if (select_insert && !is_insert_tables_num_set &&
if (select_insert) table_list->top_table() == first_select_table)
{
/*
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<TABLE_LIST> leaves;
TABLE_LIST *table= tables;
make_leaves_for_single_table(thd, leaves, table, full_table_list,
first_select_table);
List_iterator<TABLE_LIST> ti(leaves);
while ((table_list= ti++))
{ {
if (setup_table_attributes(thd, table_list, first_select_table, /* new counting for SELECT of INSERT ... SELECT command */
tablenr)) 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); DBUG_RETURN(1);
} }
tablenr++;
}
if (tablenr > MAX_TABLES)
{
my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast<int>(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 else
@@ -9204,22 +9138,13 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table,
if (!result && triggers) 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, if (triggers->process_triggers(thd, event, TRG_ACTION_BEFORE,
TRUE) || TRUE) ||
not_null_fields_have_null_values(table)) not_null_fields_have_null_values(table))
{ {
thd->bulk_param= save_bulk_param;
return TRUE; return TRUE;
} }
thd->bulk_param= save_bulk_param;
/* /*
Re-calculate virtual fields to cater for cases when base columns are Re-calculate virtual fields to cater for cases when base columns are

View File

@@ -845,17 +845,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
delete_history); delete_history);
if (delete_record) if (delete_record)
{ {
void *save_bulk_param= thd->bulk_param;
thd->bulk_param= nullptr;
if (!delete_history && table->triggers && if (!delete_history && table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE, table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_BEFORE, FALSE)) TRG_ACTION_BEFORE, FALSE))
{ {
error= 1; error= 1;
thd->bulk_param= save_bulk_param;
break; break;
} }
thd->bulk_param= save_bulk_param;
// no LIMIT / OFFSET // no LIMIT / OFFSET
if (returning && result->send_data(returning->item_list) < 0) 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)) if (likely(!error))
{ {
deleted++; deleted++;
thd->bulk_param= nullptr;
if (!delete_history && table->triggers && if (!delete_history && table->triggers &&
table->triggers->process_triggers(thd, TRG_EVENT_DELETE, table->triggers->process_triggers(thd, TRG_EVENT_DELETE,
TRG_ACTION_AFTER, FALSE)) TRG_ACTION_AFTER, FALSE))
{ {
error= 1; error= 1;
thd->bulk_param= save_bulk_param;
break; break;
} }
thd->bulk_param= save_bulk_param;
if (!--limit && using_limit) if (!--limit && using_limit)
{ {
error= -1; error= -1;

View File

@@ -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); MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
int res= item->save_in_field(key_part->field, 1); int res= item->save_in_field(key_part->field, 1);
dbug_tmp_restore_column_map(&table->write_set, old_map); dbug_tmp_restore_column_map(&table->write_set, old_map);
if (res) if (res < 0 || thd->is_error())
return 1; return 1;
} }
key_len+= key_part->store_length; key_len+= key_part->store_length;

View File

@@ -1103,21 +1103,12 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
} }
table->reset_default_fields(); 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, if (unlikely(fill_record_n_invoke_before_triggers(thd, table,
table-> table->
field_to_fill(), field_to_fill(),
*values, 0, *values, 0,
TRG_EVENT_INSERT))) TRG_EVENT_INSERT)))
{ {
thd->bulk_param= save_bulk_param;
if (values_list.elements != 1 && ! thd->is_error()) if (values_list.elements != 1 && ! thd->is_error())
{ {
info.records++; info.records++;
@@ -1126,7 +1117,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
error=1; error=1;
break; 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) if (insert_into_view && !fields.elements)
{ {
thd->lex->empty_field_list_on_rset= 1; 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), my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0),
table_list->view_db.str, table_list->view_name.str); 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) if (sel_res)
sel_res->prepare(lex->returning()->item_list, NULL); sel_res->prepare(lex->returning()->item_list, NULL);
DBUG_ASSERT(select_lex->leaf_tables.elements != 0);
List_iterator<TABLE_LIST> ti(select_lex->leaf_tables); List_iterator<TABLE_LIST> ti(select_lex->leaf_tables);
TABLE_LIST *table; TABLE_LIST *table;
uint insert_tables; uint insert_tables;

View File

@@ -1155,8 +1155,7 @@ static bool wsrep_command_no_result(char command)
{ {
return (command == COM_STMT_FETCH || return (command == COM_STMT_FETCH ||
command == COM_STMT_SEND_LONG_DATA || command == COM_STMT_SEND_LONG_DATA ||
command == COM_STMT_CLOSE || command == COM_STMT_CLOSE);
command == COM_STMT_PREPARE);
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
@@ -2400,13 +2399,23 @@ resume:
{ {
DEBUG_SYNC(thd, "wsrep_at_dispatch_end_before_result"); DEBUG_SYNC(thd, "wsrep_at_dispatch_end_before_result");
} }
wsrep_after_command_before_result(thd); if (thd->wsrep_cs().state() == wsrep::client_state::s_exec)
if (wsrep_current_error(thd) && !wsrep_command_no_result(command))
{ {
/* todo: Pass wsrep client state current error to override */ wsrep_after_command_before_result(thd);
wsrep_override_error(thd, wsrep_current_error(thd), if (wsrep_current_error(thd) && !wsrep_command_no_result(command))
wsrep_current_error_status(thd)); {
WSREP_LOG_THD(thd, "leave"); /* 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)) if (WSREP(thd))
{ {

View File

@@ -2479,6 +2479,16 @@ static bool check_prepared_statement(Prepared_statement *stmt)
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (wsrep_sync_wait(thd, sql_command)) if (wsrep_sync_wait(thd, sql_command))
goto error; 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 #endif
switch (sql_command) { switch (sql_command) {
case SQLCOM_REPLACE: case SQLCOM_REPLACE:

View File

@@ -2158,6 +2158,7 @@ JOIN::optimize_inner()
/* Merge all mergeable derived tables/views in this SELECT. */ /* Merge all mergeable derived tables/views in this SELECT. */
if (select_lex->handle_derived(thd->lex, DT_MERGE)) if (select_lex->handle_derived(thd->lex, DT_MERGE))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
table_count= select_lex->leaf_tables.elements;
} }
if (select_lex->first_cond_optimization && if (select_lex->first_cond_optimization &&
@@ -2205,6 +2206,8 @@ JOIN::optimize_inner()
eval_select_list_used_tables(); eval_select_list_used_tables();
table_count= select_lex->leaf_tables.elements;
if (select_lex->options & OPTION_SCHEMA_TABLE && if (select_lex->options & OPTION_SCHEMA_TABLE &&
optimize_schema_tables_memory_usage(select_lex->leaf_tables)) optimize_schema_tables_memory_usage(select_lex->leaf_tables))
DBUG_RETURN(1); DBUG_RETURN(1);
@@ -15812,6 +15815,7 @@ void JOIN::cleanup(bool full)
/* Free the original optimized join created for the group_by_handler */ /* Free the original optimized join created for the group_by_handler */
join_tab= original_join_tab; join_tab= original_join_tab;
original_join_tab= 0; original_join_tab= 0;
table_count= original_table_count;
} }
if (join_tab) if (join_tab)

View File

@@ -1352,6 +1352,7 @@ public:
Pushdown_query *pushdown_query; Pushdown_query *pushdown_query;
JOIN_TAB *original_join_tab; JOIN_TAB *original_join_tab;
uint original_table_count;
uint sort_space; uint sort_space;
/******* Join optimization state members start *******/ /******* Join optimization state members start *******/

View File

@@ -2479,6 +2479,14 @@ bool Table_triggers_list::process_triggers(THD *thd,
*/ */
save_current_select= thd->lex->current_select; 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 { do {
thd->lex->current_select= NULL; thd->lex->current_select= NULL;
err_status= err_status=
@@ -2488,6 +2496,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
&trigger->subject_table_grants); &trigger->subject_table_grants);
status_var_increment(thd->status_var.executed_triggers); status_var_increment(thd->status_var.executed_triggers);
} while (!err_status && (trigger= trigger->next)); } while (!err_status && (trigger= trigger->next));
thd->bulk_param= save_bulk_param;
thd->lex->current_select= save_current_select; thd->lex->current_select= save_current_select;
thd->restore_sub_statement_state(&statement_state); thd->restore_sub_statement_state(&statement_state);

View File

@@ -1026,7 +1026,8 @@ bool select_union_direct::send_eof()
// Reset for each SELECT_LEX, so accumulate here // Reset for each SELECT_LEX, so accumulate here
limit_found_rows+= thd->limit_found_rows; 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; thd->limit_found_rows= limit_found_rows;

View File

@@ -1181,19 +1181,14 @@ error:
rows_inserted++; rows_inserted++;
} }
void *save_bulk_param= thd->bulk_param;
thd->bulk_param= nullptr;
if (table->triggers && if (table->triggers &&
unlikely(table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, unlikely(table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
TRG_ACTION_AFTER, TRUE))) TRG_ACTION_AFTER, TRUE)))
{ {
error= 1; error= 1;
thd->bulk_param= save_bulk_param;
break; break;
} }
thd->bulk_param= save_bulk_param;
if (!--limit && using_limit) if (!--limit && using_limit)
{ {

View File

@@ -2524,7 +2524,7 @@ Frame_cursor *get_frame_cursor(THD *thd, Window_spec *spec, bool is_top_bound)
} }
static 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) Item_window_func *window_func)
{ {
Window_spec *spec= window_func->window_spec; 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 *offset_func= new (thd->mem_root)
Item_func_minus(thd, item_sum->get_arg(1), Item_func_minus(thd, item_sum->get_arg(1),
int_item); 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, fc= new Frame_positional_cursor(*top_bound,
*top_bound, *bottom_bound, *top_bound, *bottom_bound,
*offset_func, false); *offset_func, false);
@@ -2644,6 +2646,7 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager,
fc->add_sum_func(item_sum); fc->add_sum_func(item_sum);
cursor_manager->add_cursor(fc); 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, If the window functions share the same frame specification,
those window functions will be registered to the same cursor. those window functions will be registered to the same cursor.
*/ */
void get_window_functions_required_cursors( bool get_window_functions_required_cursors(
THD *thd, THD *thd,
List<Item_window_func>& window_functions, List<Item_window_func>& window_functions,
List<Cursor_manager> *cursor_managers) List<Cursor_manager> *cursor_managers)
@@ -2722,7 +2725,8 @@ void get_window_functions_required_cursors(
if (item_win_func->is_frame_prohibited() || if (item_win_func->is_frame_prohibited() ||
item_win_func->requires_special_cursors()) 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); cursor_managers->push_back(cursor_manager);
continue; continue;
} }
@@ -2756,6 +2760,7 @@ void get_window_functions_required_cursors(
} }
cursor_managers->push_back(cursor_manager); 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(); it.rewind();
List<Cursor_manager> cursor_managers; List<Cursor_manager> cursor_managers;
get_window_functions_required_cursors(thd, window_functions, if (get_window_functions_required_cursors(thd, window_functions,
&cursor_managers); &cursor_managers))
return true;
/* Go through the sorted array and compute the window function */ /* Go through the sorted array and compute the window function */
bool is_error= compute_window_func(thd, bool is_error= compute_window_func(thd,

View File

@@ -1603,35 +1603,7 @@ bool wsrep_sync_wait (THD* thd, uint mask)
This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0 This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0
TODO: modify to check if thd has locked any rows. TODO: modify to check if thd has locked any rows.
*/ */
if (thd->wsrep_cs().sync_wait(-1)) return 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 false; return false;

View File

@@ -3645,24 +3645,12 @@ retry:
} }
else 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); page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain);
/* It does not make sense to use transactional_lock_guard here, /* It does not make sense to use transactional_lock_guard here,
because buf_relocate() would likely make the memory transaction because buf_relocate() would likely make the memory transaction
too large. */ too large. */
hash_lock.lock(); 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); mysql_mutex_lock(&buf_pool.flush_list_mutex);
buf_relocate(bpage, &free_block->page); buf_relocate(bpage, &free_block->page);
free_block->page.lock.x_lock(); free_block->page.lock.x_lock();

View File

@@ -3005,7 +3005,10 @@ static int innobase_rollback_by_xid(handlerton*, XID *xid) noexcept
return XAER_RMFAIL; return XAER_RMFAIL;
if (trx_t *trx= trx_get_trx_by_xid(xid)) 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); trx_deregister_from_2pc(trx);
THD* thd= trx->mysql_thd; THD* thd= trx->mysql_thd;
dberr_t err= trx_rollback_for_mysql(trx); dberr_t err= trx_rollback_for_mysql(trx);

View File

@@ -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

View File

@@ -0,0 +1,5 @@
[mysqld.1.1]
socket= /tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock
[ENV]
MASTER_1_MYSOCK= @mysqld.1.1.socket

View File

@@ -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

View File

@@ -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 Return system error text for given error number
@@ -947,6 +968,10 @@ const char* my_strerror(char *buf, size_t len, int nr)
#else #else
strerror_r(nr, buf, len); strerror_r(nr, buf, len);
#endif #endif
#ifdef __APPLE__
delete_colon_char(buf);
#endif
} }
/* /*

View File

@@ -22506,6 +22506,129 @@ static void test_mdev_34718_ad()
rc= mysql_query(mysql, "DROP TABLE t1, t2"); rc= mysql_query(mysql, "DROP TABLE t1, t2");
myquery(rc); 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 #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_au", test_mdev_34718_au },
{ "test_mdev_34718_bd", test_mdev_34718_bd }, { "test_mdev_34718_bd", test_mdev_34718_bd },
{ "test_mdev_34718_ad", test_mdev_34718_ad }, { "test_mdev_34718_ad", test_mdev_34718_ad },
{ "test_mdev_34958", test_mdev_34958 },
#endif #endif
{ "test_mdev_10075", test_mdev_10075}, { "test_mdev_10075", test_mdev_10075},
{ 0, 0 } { 0, 0 }