summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-10-17 08:44:12 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-10-17 08:44:12 +0200
commitf3fddc1b4a3d05167303a87b04be985b17096a46 (patch)
tree534d55b0c299a36dfda13b0829a9313b857ee063 /sql/table.cc
parent851b31bcc47b742cd3b39ad06176b0e8be591c18 (diff)
parentec2b30e7367fcd4b2af0d7ae42d7b83148a859a4 (diff)
downloadmariadb-git-f3fddc1b4a3d05167303a87b04be985b17096a46.tar.gz
Merge branch '10.7' into 10.8
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/sql/table.cc b/sql/table.cc
index e1e61eb2a26..b25779c3de8 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);
}