summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t/foreign_key.test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-02-17 10:48:24 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-02-17 10:48:24 +0200
commit73c391afc5f9315658e0486a375dbce2d109b9b5 (patch)
treeb5cff77840f7226d065292e4e0d471c6e07cbcee /mysql-test/suite/innodb/t/foreign_key.test
parentda64e503fb8715df1c592cf82c657be49bbfcd78 (diff)
downloadmariadb-git-73c391afc5f9315658e0486a375dbce2d109b9b5.tar.gz
MDEV-27583 InnoDB uses different constants for FK cascade error message in SQL vs error log
convert_error_code_to_mysql(): Use the correct limit FK_MAX_CASCADE_DEL in the error message. The DICT_FK_MAX_RECURSIVE_LOAD applies to the number of foreign key constraints in table definitions, not to the number of rows that are visited while processing a foreign key constraint.
Diffstat (limited to 'mysql-test/suite/innodb/t/foreign_key.test')
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test23
1 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 08f2c529659..1d4e5fd9d2a 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -822,6 +822,29 @@ eval create table t1($fk_ref int primary key, $fk_field int, $constrs) engine in
drop table t1;
--enable_query_log
+--echo #
+--echo # MDEV-27583 InnoDB uses different constants for FK cascade
+--echo # error message in SQL vs error log
+--echo #
+
+CREATE TABLE t1
+(a INT, b INT, KEY(b),
+CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE)
+ENGINE=InnoDB;
+
+INSERT INTO t1 (a,b) VALUES
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,1),(1,0);
+
+--error ER_GET_ERRMSG
+DELETE FROM t1 WHERE b = 1;
+SHOW WARNINGS;
+DROP TABLE t1;
+
+let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
+let SEARCH_PATTERN= InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15.*;
+-- source include/search_pattern_in_file.inc
+
--echo # End of 10.2 tests
--source include/wait_until_count_sessions.inc