mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
merge mysql-5.5->mysql-5.5-security
This commit is contained in:
@@ -2679,6 +2679,8 @@ CREATE TABLE replace_table (a INT, b INT, PRIMARY KEY(a));
|
||||
INSERT INTO replace_table values (1,1),(2,2);
|
||||
CREATE TABLE update_table (a INT, b INT, PRIMARY KEY(a));
|
||||
INSERT INTO update_table values (1,1),(2,2);
|
||||
CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY) ENGINE = InnoDB;
|
||||
INSERT INTO insert_2_keys values (1, 1);
|
||||
INSERT IGNORE INTO insert_table SELECT * FROM filler_table;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT IGNORE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are ignored. This order cannot be predicted and may differ on master and the slave.
|
||||
@@ -2702,10 +2704,15 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
|
||||
CREATE TEMPORARY TABLE temp1 (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * FROM filler_table;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. CREATE... REPLACE SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
|
||||
INSERT INTO insert_2_keys VALUES (1, 2)
|
||||
ON DUPLICATE KEY UPDATE a=VALUES(a)+10, b=VALUES(b)+10;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
|
||||
DROP TABLE filler_table;
|
||||
DROP TABLE insert_table;
|
||||
DROP TABLE update_table;
|
||||
DROP TABLE replace_table;
|
||||
DROP TABLE create_ignore_test;
|
||||
DROP TABLE create_replace_test;
|
||||
DROP TABLE insert_2_keys;
|
||||
"End of tests"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
# - CREATE TABLE [IGNORE/REPLACE] SELECT
|
||||
# - INSERT IGNORE...SELECT
|
||||
# - UPDATE IGNORE
|
||||
# - INSERT... ON DUPLICATE KEY UPDATE on a table with two UNIQUE KEYS
|
||||
#
|
||||
# Note that statements that use stored functions, stored procedures,
|
||||
# triggers, views, or prepared statements that invoke unsafe
|
||||
@@ -714,6 +715,9 @@ DROP TABLE t1;
|
||||
#UPDATE IGNORE
|
||||
#CREATE TABLE... IGNORE SELECT
|
||||
#CREATE TABLE... REPLACE SELECT
|
||||
#
|
||||
###BUG 11765650 - 58637: MARK UPDATES THAT DEPEND ON ORDER OF TWO KEYS UNSAFE
|
||||
#INSERT.... ON DUP KEY UPDATE on a table with more than one UNIQUE KEY
|
||||
|
||||
#setup tables
|
||||
CREATE TABLE filler_table (a INT, b INT);
|
||||
@@ -723,6 +727,8 @@ CREATE TABLE replace_table (a INT, b INT, PRIMARY KEY(a));
|
||||
INSERT INTO replace_table values (1,1),(2,2);
|
||||
CREATE TABLE update_table (a INT, b INT, PRIMARY KEY(a));
|
||||
INSERT INTO update_table values (1,1),(2,2);
|
||||
CREATE TABLE insert_2_keys (a INT UNIQUE KEY, b INT UNIQUE KEY) ENGINE = InnoDB;
|
||||
INSERT INTO insert_2_keys values (1, 1);
|
||||
|
||||
#INSERT IGNORE... SELECT
|
||||
INSERT IGNORE INTO insert_table SELECT * FROM filler_table;
|
||||
@@ -740,6 +746,10 @@ CREATE TABLE create_replace_test (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT *
|
||||
#temporary tables should not throw the warning.
|
||||
CREATE TEMPORARY TABLE temp1 (a INT, b INT, PRIMARY KEY(b)) REPLACE SELECT * FROM filler_table;
|
||||
|
||||
#INSERT.... ON DUP KEY UPDATE on a table with more than one UNIQUE KEY
|
||||
INSERT INTO insert_2_keys VALUES (1, 2)
|
||||
ON DUPLICATE KEY UPDATE a=VALUES(a)+10, b=VALUES(b)+10;
|
||||
|
||||
###clean up
|
||||
DROP TABLE filler_table;
|
||||
DROP TABLE insert_table;
|
||||
@@ -747,5 +757,6 @@ DROP TABLE update_table;
|
||||
DROP TABLE replace_table;
|
||||
DROP TABLE create_ignore_test;
|
||||
DROP TABLE create_replace_test;
|
||||
DROP TABLE insert_2_keys;
|
||||
|
||||
--echo "End of tests"
|
||||
|
||||
@@ -648,7 +648,7 @@ t2 CREATE TABLE `t2` (
|
||||
`n` int(10) unsigned NOT NULL,
|
||||
`o` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`m`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
@@ -657,7 +657,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
@@ -671,16 +671,16 @@ a b c
|
||||
8 4 FALSE
|
||||
9 5 TRUE
|
||||
10 5 FALSE
|
||||
13 1 TRUE
|
||||
14 1 FALSE
|
||||
15 2 TRUE
|
||||
16 2 FALSE
|
||||
17 3 TRUE
|
||||
18 3 FALSE
|
||||
19 4 TRUE
|
||||
20 4 FALSE
|
||||
21 5 TRUE
|
||||
22 5 FALSE
|
||||
16 1 TRUE
|
||||
17 1 FALSE
|
||||
18 2 TRUE
|
||||
19 2 FALSE
|
||||
20 3 TRUE
|
||||
21 3 FALSE
|
||||
22 4 TRUE
|
||||
23 4 FALSE
|
||||
24 5 TRUE
|
||||
25 5 FALSE
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -688,7 +688,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
@@ -702,21 +702,21 @@ a b c
|
||||
8 4 FALSE
|
||||
9 5 TRUE
|
||||
10 5 FALSE
|
||||
13 1 TRUE
|
||||
14 1 FALSE
|
||||
15 2 TRUE
|
||||
16 2 FALSE
|
||||
17 3 TRUE
|
||||
18 3 FALSE
|
||||
19 4 TRUE
|
||||
20 4 FALSE
|
||||
21 5 TRUE
|
||||
22 5 FALSE
|
||||
23 1 FALSE
|
||||
24 2 FALSE
|
||||
25 3 FALSE
|
||||
26 4 FALSE
|
||||
27 5 FALSE
|
||||
16 1 TRUE
|
||||
17 1 FALSE
|
||||
18 2 TRUE
|
||||
19 2 FALSE
|
||||
20 3 TRUE
|
||||
21 3 FALSE
|
||||
22 4 TRUE
|
||||
23 4 FALSE
|
||||
24 5 TRUE
|
||||
25 5 FALSE
|
||||
31 1 FALSE
|
||||
32 2 FALSE
|
||||
33 3 FALSE
|
||||
34 4 FALSE
|
||||
35 5 FALSE
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -724,7 +724,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
@@ -738,26 +738,26 @@ a b c
|
||||
8 4 FALSE
|
||||
9 5 TRUE
|
||||
10 5 FALSE
|
||||
13 1 TRUE
|
||||
14 1 FALSE
|
||||
15 2 TRUE
|
||||
16 2 FALSE
|
||||
17 3 TRUE
|
||||
18 3 FALSE
|
||||
19 4 TRUE
|
||||
20 4 FALSE
|
||||
21 5 TRUE
|
||||
22 5 FALSE
|
||||
23 1 FALSE
|
||||
24 2 FALSE
|
||||
25 3 FALSE
|
||||
26 4 FALSE
|
||||
27 5 FALSE
|
||||
30 1 FALSE
|
||||
31 2 FALSE
|
||||
32 3 FALSE
|
||||
33 4 FALSE
|
||||
34 5 FALSE
|
||||
16 1 TRUE
|
||||
17 1 FALSE
|
||||
18 2 TRUE
|
||||
19 2 FALSE
|
||||
20 3 TRUE
|
||||
21 3 FALSE
|
||||
22 4 TRUE
|
||||
23 4 FALSE
|
||||
24 5 TRUE
|
||||
25 5 FALSE
|
||||
31 1 FALSE
|
||||
32 2 FALSE
|
||||
33 3 FALSE
|
||||
34 4 FALSE
|
||||
35 5 FALSE
|
||||
38 1 FALSE
|
||||
39 2 FALSE
|
||||
40 3 FALSE
|
||||
41 4 FALSE
|
||||
42 5 FALSE
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -765,7 +765,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
@@ -774,7 +774,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
@@ -783,7 +783,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false';
|
||||
SELECT * FROM t1;
|
||||
a b c
|
||||
@@ -797,41 +797,41 @@ a b c
|
||||
8 4 FALSE
|
||||
9 5 TRUE
|
||||
10 5 FALSE
|
||||
13 1 TRUE
|
||||
14 1 FALSE
|
||||
15 2 TRUE
|
||||
16 2 FALSE
|
||||
17 3 TRUE
|
||||
18 3 FALSE
|
||||
19 4 TRUE
|
||||
20 4 FALSE
|
||||
21 5 TRUE
|
||||
22 5 FALSE
|
||||
23 1 FALSE
|
||||
24 2 FALSE
|
||||
25 3 FALSE
|
||||
26 4 FALSE
|
||||
27 5 FALSE
|
||||
30 1 FALSE
|
||||
31 2 FALSE
|
||||
32 3 FALSE
|
||||
33 4 FALSE
|
||||
34 5 FALSE
|
||||
37 1 FALSE
|
||||
38 2 FALSE
|
||||
39 3 FALSE
|
||||
40 4 FALSE
|
||||
41 5 FALSE
|
||||
44 1 FALSE
|
||||
45 2 FALSE
|
||||
46 3 FALSE
|
||||
47 4 FALSE
|
||||
48 5 FALSE
|
||||
51 1 FALSE
|
||||
52 2 FALSE
|
||||
53 3 FALSE
|
||||
54 4 FALSE
|
||||
55 5 FALSE
|
||||
16 1 TRUE
|
||||
17 1 FALSE
|
||||
18 2 TRUE
|
||||
19 2 FALSE
|
||||
20 3 TRUE
|
||||
21 3 FALSE
|
||||
22 4 TRUE
|
||||
23 4 FALSE
|
||||
24 5 TRUE
|
||||
25 5 FALSE
|
||||
31 1 FALSE
|
||||
32 2 FALSE
|
||||
33 3 FALSE
|
||||
34 4 FALSE
|
||||
35 5 FALSE
|
||||
38 1 FALSE
|
||||
39 2 FALSE
|
||||
40 3 FALSE
|
||||
41 4 FALSE
|
||||
42 5 FALSE
|
||||
45 1 FALSE
|
||||
46 2 FALSE
|
||||
47 3 FALSE
|
||||
48 4 FALSE
|
||||
49 5 FALSE
|
||||
52 1 FALSE
|
||||
53 2 FALSE
|
||||
54 3 FALSE
|
||||
55 4 FALSE
|
||||
56 5 FALSE
|
||||
59 1 FALSE
|
||||
60 2 FALSE
|
||||
61 3 FALSE
|
||||
62 4 FALSE
|
||||
63 5 FALSE
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
@@ -839,7 +839,7 @@ t1 CREATE TABLE `t1` (
|
||||
`b` int(10) unsigned NOT NULL,
|
||||
`c` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
@@ -1251,3 +1251,21 @@ t1 CREATE TABLE `t1` (
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
Variable_name Value
|
||||
auto_increment_increment 1
|
||||
auto_increment_offset 256
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`c2` varchar(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`c1`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
|
||||
SELECT * FROM t1;
|
||||
c1 c2
|
||||
1 NULL
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -637,3 +637,14 @@ INSERT INTO t1 VALUES (18446744073709551615);
|
||||
-- source include/restart_mysqld.inc
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
# Check if we handl offset > column max value properly
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=256;
|
||||
SHOW VARIABLES LIKE "%auto_inc%";
|
||||
# TINYINT
|
||||
CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, NULL);
|
||||
SHOW CREATE TABLE t1;
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -4,6 +4,8 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
|
||||
UNIQUE(b));
|
||||
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
|
||||
Warnings:
|
||||
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. INSERT... ON DUPLICATE KEY UPDATE on a table with more than one UNIQUE KEY is unsafe
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
1 10
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
|
||||
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
|
||||
include/start_slave.inc
|
||||
[Slave restarted with the report-port set to some value]
|
||||
include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.]
|
||||
include/rpl_restart_server.inc [server_number=2 parameters: --report-port=]
|
||||
include/start_slave.inc
|
||||
[Slave restarted with the report-port set to the value of slave's port number]
|
||||
include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
|
||||
include/rpl_end.inc
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
--report-port=
|
||||
@@ -10,22 +10,18 @@
|
||||
#
|
||||
#====Method====
|
||||
#
|
||||
# Start replication with report port not set.This will give the actual port
|
||||
# number of the slave (ie. SLAVE_PORT) for the on doing SHOW SLAVE HOSTS on
|
||||
# the master.
|
||||
# Restart the slave server with report port set to 9000 and start the slave.
|
||||
# Start replication with report port set to 9000 and restart the slave.
|
||||
# In this case on doing SHOW SLAVE HOSTS on the master, we get the port number
|
||||
# of the slave to be 9000.
|
||||
# In the second case restart the slave server with report port not set. In this
|
||||
# case on doing SHOW SLAVE HOSTS on the master, we get the actual port number
|
||||
# of the slave (ie. SLAVE_PORT).
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_binlog_format_mixed.inc;
|
||||
|
||||
connection master;
|
||||
|
||||
--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
|
||||
--let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
|
||||
--let assert_cond= $report_port = "$SLAVE_MYPORT"
|
||||
--source include/assert.inc
|
||||
|
||||
# Start the server with some value being passed to the report_port= <option>
|
||||
# this will be used incase we have to mask the value of the slave's port
|
||||
# number in certain situations.
|
||||
@@ -46,4 +42,25 @@ connection master;
|
||||
--let assert_cond= $report_port = "9000"
|
||||
--source include/assert.inc
|
||||
|
||||
|
||||
# Start the server with the report-port being passed with no value. So on SHOW SLAVE HOSTS
|
||||
# on the master the value of slave's port should be the actual value of the slave port.
|
||||
|
||||
--let $rpl_server_number= 2
|
||||
--let $rpl_server_parameters= --report-port=
|
||||
--source include/rpl_restart_server.inc
|
||||
|
||||
connection slave;
|
||||
--source include/start_slave.inc
|
||||
|
||||
--echo [Slave restarted with the report-port set to the value of slave's port number]
|
||||
|
||||
connection master;
|
||||
|
||||
# The value reported is the actual value of the slave's port.
|
||||
--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
|
||||
--let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
|
||||
--let assert_cond= $report_port = "$SLAVE_MYPORT"
|
||||
--source include/assert.inc
|
||||
|
||||
--source include/rpl_end.inc
|
||||
|
||||
Reference in New Issue
Block a user