mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge from mysql-5.1.60-release
This commit is contained in:
@ -1293,6 +1293,20 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
ERROR 42S22: Unknown column 't1.id' in 'where clause'
|
||||
drop table t3,t2,t1;
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 2 would lead to a duplicate entry
|
||||
DROP TABLE t2,t1;
|
||||
create table t1(
|
||||
id int primary key,
|
||||
pid int,
|
||||
@ -1671,7 +1685,7 @@ variable_value - @innodb_rows_deleted_orig
|
||||
71
|
||||
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
|
||||
variable_value - @innodb_rows_inserted_orig
|
||||
1063
|
||||
1067
|
||||
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
|
||||
variable_value - @innodb_rows_updated_orig
|
||||
865
|
||||
|
2
mysql-test/suite/innodb/r/innodb_bug12661768.result
Normal file
2
mysql-test/suite/innodb/r/innodb_bug12661768.result
Normal file
@ -0,0 +1,2 @@
|
||||
SET SESSION foreign_key_checks=0;
|
||||
ERROR 23000: Upholding foreign key constraints for table 'bug12661768_1', entry '3-bbb', key 2 would lead to a duplicate entry
|
@ -1021,6 +1021,24 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
|
||||
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
|
||||
drop table t3,t2,t1;
|
||||
|
||||
# test ON UPDATE CASCADE
|
||||
CREATE TABLE t1 (
|
||||
c1 VARCHAR(8), c2 VARCHAR(8),
|
||||
PRIMARY KEY (c1, c2)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
c0 INT PRIMARY KEY,
|
||||
c1 VARCHAR(8) UNIQUE,
|
||||
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
|
||||
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
|
||||
-- error ER_FOREIGN_DUPLICATE_KEY
|
||||
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
|
||||
DROP TABLE t2,t1;
|
||||
|
||||
#
|
||||
# test for recursion depth limit
|
||||
#
|
||||
|
50
mysql-test/suite/innodb/t/innodb_bug12661768.test
Normal file
50
mysql-test/suite/innodb/t/innodb_bug12661768.test
Normal file
@ -0,0 +1,50 @@
|
||||
#
|
||||
# Bug#12661768 UPDATE IGNORE CRASHES SERVER IF TABLE IS INNODB AND IT IS
|
||||
# PARENT FOR OTHER ONE
|
||||
#
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
SET SESSION foreign_key_checks=0;
|
||||
|
||||
# only interested that the "UPDATE IGNORE" at the end does not crash the server
|
||||
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
|
||||
SET NAMES utf8;
|
||||
|
||||
-- let $t1_name = bug12661768_1
|
||||
-- let $t2_name = bug12661768_2
|
||||
-- let $fk_name = ab_on_2
|
||||
-- let $key_str = 'bbb'
|
||||
|
||||
eval DROP TABLE IF EXISTS `$t2_name`, `$t1_name`;
|
||||
|
||||
eval CREATE TABLE `$t1_name` (
|
||||
a INT,
|
||||
b VARCHAR(512),
|
||||
PRIMARY KEY (a, b)
|
||||
) ENGINE=INNODB;
|
||||
|
||||
eval CREATE TABLE `$t2_name` (
|
||||
id INT,
|
||||
a INT,
|
||||
b VARCHAR(512),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY `$fk_name` (a, b),
|
||||
FOREIGN KEY (a, b) REFERENCES `$t1_name` (a, b)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE
|
||||
) ENGINE=INNODB;
|
||||
|
||||
eval INSERT INTO `$t1_name` VALUES (1, $key_str);
|
||||
eval INSERT INTO `$t2_name` VALUES (100, 1, $key_str), (101, 3, $key_str);
|
||||
|
||||
SET SESSION foreign_key_checks=1;
|
||||
|
||||
-- enable_result_log
|
||||
|
||||
-- error ER_FOREIGN_DUPLICATE_KEY
|
||||
eval UPDATE IGNORE `$t1_name` SET a = 3;
|
||||
|
||||
eval DROP TABLE `$t2_name`, `$t1_name`;
|
Reference in New Issue
Block a user