diff options
author | Sergei Golubchik <serg@mariadb.org> | 2022-11-03 18:31:42 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-01-17 15:28:56 +0100 |
commit | a5eff044cb8543cc207ec51965a1d8fd51dd0576 (patch) | |
tree | a72916f3bcff3c6528312c138347fa497b4f8352 | |
parent | 107d54600ebf6e87c43c8a9d95b289fabf8f31fe (diff) | |
download | mariadb-git-a5eff044cb8543cc207ec51965a1d8fd51dd0576.tar.gz |
MDEV-22602 Disable UPDATE CASCADE for SQL constraints
fix it for named constraints too
-rw-r--r-- | mysql-test/suite/innodb/r/foreign_key.result | 2 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/foreign_key.test | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result index f8f389a32cf..851deb69fa5 100644 --- a/mysql-test/suite/innodb/r/foreign_key.result +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -943,6 +943,8 @@ DROP TABLE t1; # # TODO: enable them after MDEV-16417 is finished create or replace table t1 (a int primary key) engine=innodb; +create or replace table t2 (a int, constraint foo check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; +ERROR HY000: Function or expression 'a' cannot be used in the CHECK clause of `foo` create or replace table t2 (a int, check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; ERROR HY000: Function or expression 'a' cannot be used in the CHECK clause of `CONSTRAINT_1` create or replace table t1 (f1 int, f2 date, f3 date, key(f1,f3,f2)) engine=innodb; diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index 321c78a5598..135f8d7b024 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -971,6 +971,8 @@ DROP TABLE t1; --echo # TODO: enable them after MDEV-16417 is finished create or replace table t1 (a int primary key) engine=innodb; --error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED +create or replace table t2 (a int, constraint foo check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; +--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED create or replace table t2 (a int, check(a > 0), foreign key(a) references t1(a) on update cascade) engine=innodb; create or replace table t1 (f1 int, f2 date, f3 date, key(f1,f3,f2)) engine=innodb; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 519a5f38868..dbab4c0067c 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4622,7 +4622,7 @@ without_overlaps_err: my_error(ER_TOO_LONG_IDENT, MYF(0), check->name.str); DBUG_RETURN(TRUE); } - if (check_expression(check, &check->name, VCOL_CHECK_TABLE)) + if (check_expression(check, &check->name, VCOL_CHECK_TABLE, alter_info)) DBUG_RETURN(TRUE); } } |