diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-10-13 17:05:30 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-10-13 17:05:30 +0300 |
commit | 66e44afd946777607fd769ccf6c8c1b6d3bad174 (patch) | |
tree | ad9955eb82d89dade13fabd5070a0b786e9483ac /sql/table.cc | |
parent | 5fffdbc8d5cbae5b63513d5e3d023bb4c928ec90 (diff) | |
parent | f40491155704ba6e280e2c22b722a7af1d202895 (diff) | |
download | mariadb-git-66e44afd946777607fd769ccf6c8c1b6d3bad174.tar.gz |
Merge 10.4 into 10.5
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 7c3bc88de2c..299bafcd0db 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8794,12 +8794,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 @@ -8813,6 +8829,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); } |