diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-10-17 19:14:32 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-10-17 19:14:32 +0200 |
commit | 4f13509eea8078dfc986e33fe48036cfaaf31b02 (patch) | |
tree | ba729f0eac4e0febc4c46a7b2be7cbd5cc9e1f6e /sql/table.cc | |
parent | 35b831d97193d0f8f0bf0ffdaf12218cf091e568 (diff) | |
parent | 648bedf0e52132c1cbc28cd4a88fb576da1088ca (diff) | |
download | mariadb-git-4f13509eea8078dfc986e33fe48036cfaaf31b02.tar.gz |
Merge branch 'bb-10.10-release' into bb-10.11-release
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 e1149ef72f1..0476d8f2bd0 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8914,12 +8914,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 @@ -8933,6 +8949,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); } |