diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2020-06-12 11:10:55 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2020-06-12 11:12:40 +0300 |
commit | 762bf7a03b6214f091a66ca8683df341112d7d4a (patch) | |
tree | eb86fdd1eda7b8d04dd51cde33a44c629f651528 /sql/field.cc | |
parent | 02c255d1e017072858ef812b8c5c5f4e217fb6c4 (diff) | |
download | mariadb-git-762bf7a03b6214f091a66ca8683df341112d7d4a.tar.gz |
MDEV-22602 Disable UPDATE CASCADE for SQL constraints
CHECK constraint is checked by check_expression() which walks its
items and gets into Item_field::check_vcol_func_processor() to check
for conformity with foreign key list.
WITHOUT OVERLAPS is checked for same conformity in
mysql_prepare_create_table().
Long uniques are already impossible with InnoDB foreign keys. See
ER_CANT_CREATE_TABLE in test case.
2 accompanying bugs fixed (test main.constraints failed):
1. check->name.str lived on SP execute mem_root while "check" obj
itself lives on SP main mem_root. On second SP execute check->name.str
had garbage data. Fixed by allocating from thd->stmt_arena->mem_root
which is SP main mem_root.
2. CHECK_CONSTRAINT_IF_NOT_EXISTS value was mixed with
VCOL_FIELD_REF. VCOL_FIELD_REF is assigned in check_expression() and
then detected as CHECK_CONSTRAINT_IF_NOT_EXISTS in
handle_if_exists_options().
Existing cases for MDEV-16932 in main.constraints cover both fixes.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index 3422f54732c..d9b654945f6 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -10191,11 +10191,12 @@ void Column_definition::create_length_to_internal_length_newdecimal() bool check_expression(Virtual_column_info *vcol, const LEX_CSTRING *name, - enum_vcol_info_type type) + enum_vcol_info_type type, Alter_info *alter_info) { bool ret; Item::vcol_func_processor_result res; + res.alter_info= alter_info; if (!vcol->name.length) vcol->name= *name; @@ -10204,7 +10205,6 @@ bool check_expression(Virtual_column_info *vcol, const LEX_CSTRING *name, Walk through the Item tree checking if all items are valid to be part of the virtual column */ - res.errors= 0; ret= vcol->expr->walk(&Item::check_vcol_func_processor, 0, &res); vcol->flags= res.errors; |