diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-10-15 23:47:33 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-10-15 23:47:33 +0200 |
commit | 822694bd56a74eb4a81a85db683fe7b0837029ed (patch) | |
tree | 182a89cae99df0c988668997745af2f00d213ce2 /sql/table.cc | |
parent | ce6efb584d05b2b8786a09e6d20b489185042d70 (diff) | |
parent | 6b8c43baac9d7201b4ccf1edfc4bba8a722b8450 (diff) | |
download | mariadb-git-822694bd56a74eb4a81a85db683fe7b0837029ed.tar.gz |
Merge branch '10.5' into 10.6
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc index 4ea64985910..163bb798962 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8876,12 +8876,28 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode) DBUG_RETURN(in_use->is_error()); } -int TABLE::update_virtual_field(Field *vf) +/* + Calculate the virtual field value for a specified field. + @param vf A field to calculate + @param ignore_warnings Ignore the warnings and also make the + calculations permissive. This usually means + that a calculation is internal and is not + expected to fail. +*/ +int TABLE::update_virtual_field(Field *vf, bool ignore_warnings) { DBUG_ENTER("TABLE::update_virtual_field"); Query_arena backup_arena; Counting_error_handler count_errors; + Suppress_warnings_error_handler warning_handler; in_use->push_internal_handler(&count_errors); + bool abort_on_warning; + if (ignore_warnings) + { + abort_on_warning= in_use->abort_on_warning; + in_use->abort_on_warning= false; + in_use->push_internal_handler(&warning_handler); + } /* TODO: this may impose memory leak until table flush. See comment in @@ -8895,6 +8911,13 @@ int TABLE::update_virtual_field(Field *vf) DBUG_RESTORE_WRITE_SET(vf); in_use->restore_active_arena(expr_arena, &backup_arena); in_use->pop_internal_handler(); + if (ignore_warnings) + { + in_use->abort_on_warning= abort_on_warning; + in_use->pop_internal_handler(); + // This is an internal calculation, we expect it to always succeed + DBUG_ASSERT(count_errors.errors == 0); + } DBUG_RETURN(count_errors.errors); } |