summaryrefslogtreecommitdiff
path: root/sql/unireg.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-07-23 16:55:52 +0200
committerSergei Golubchik <serg@mariadb.org>2016-08-27 16:59:12 +0200
commit12d2c4fcd0bc3fbe74759e8285f2c93ad348e749 (patch)
treee8f0ec7fab2a8ec1365e10a5ddde62e7af2e885d /sql/unireg.cc
parent4070d55735f1642e563b8d60fc2e9771f4963a3f (diff)
downloadmariadb-git-12d2c4fcd0bc3fbe74759e8285f2c93ad348e749.tar.gz
optimize constant default expressions
to be calculated at the CREATE TABLE time and stored in the default row image.
Diffstat (limited to 'sql/unireg.cc')
-rw-r--r--sql/unireg.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/unireg.cc b/sql/unireg.cc
index ff46e03ab3e..add09411acb 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -634,7 +634,7 @@ static bool pack_header(THD *thd, uchar *forminfo,
if (add_expr_length(thd, &field->vcol_info, &expression_length))
DBUG_RETURN(1);
- if (field->has_default_expression())
+ if (field->default_value && field->default_value->expr_str.length)
if (add_expr_length(thd, &field->default_value, &expression_length))
DBUG_RETURN(1);
if (add_expr_length(thd, &field->check_constraint, &expression_length))
@@ -983,7 +983,7 @@ static bool pack_fields(uchar **buff_arg, List<Create_field> &create_fields,
if (field->vcol_info)
pack_expression(&buff, field->vcol_info, field_nr,
field->vcol_info->stored_in_db ? 1 : 0);
- if (field->has_default_expression())
+ if (field->default_value && field->default_value->expr_str.length)
pack_expression(&buff, field->default_value, field_nr, 2);
if (field->check_constraint)
pack_expression(&buff, field->check_constraint, field_nr, 3);