From ef5adf520760536c7396bdfe884fc509ac065694 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 4 Feb 2021 16:06:54 +0100 Subject: MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error partially revert 76063c2a13. Item::clone() is not an all-purpose Item copying machine, it was specifically created for pushdown of predicates into derived tables and views and it does not copy everything. In particular, it does not copy Item_func_regex. Fix the bug differently by preserving the old constraint name. But keep setting automatic_name=true to have it regenerated for cases like ALTER TABLE ... ADD CONSTRAINT. --- mysql-test/main/check_constraint.test | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mysql-test/main/check_constraint.test') diff --git a/mysql-test/main/check_constraint.test b/mysql-test/main/check_constraint.test index 93538fd1666..1258a9e3be6 100644 --- a/mysql-test/main/check_constraint.test +++ b/mysql-test/main/check_constraint.test @@ -176,3 +176,11 @@ select * from t1 where a is null; --error ER_CONSTRAINT_FAILED insert t1 (b) values (1); drop table t1; + +--echo # +--echo # MDEV-24274 ALTER TABLE with CHECK CONSTRAINTS gives "Out of Memory" error +--echo # +create table t1 (id varchar(2), constraint id check (id regexp '[a-z]')); +alter table t1 force; +show create table t1; +drop table t1; -- cgit v1.2.1