diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/sql/table.cc b/sql/table.cc index 4a1214cbb70..7432277f448 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1874,7 +1874,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, interval_nr= (uint)vcol_screen_pos[3]; else if ((uint)vcol_screen_pos[0] != 1) goto err; - vcol_info->stored_in_db= vcol_screen_pos[2] & 1; + bool stored= vcol_screen_pos[2] & 1; + vcol_info->stored_in_db= stored; + vcol_info->set_vcol_type(stored ? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL); vcol_expr_length= vcol_info_length - (uint)(FRM_VCOL_OLD_HEADER_SIZE(opt_interval_id)); vcol_info->utf8= 0; // before 10.2.1 the charset was unknown @@ -2763,7 +2765,7 @@ static bool fix_vcol_expr(THD *thd, Virtual_column_info *vcol) { StringBuffer<MAX_FIELD_WIDTH> str; vcol->print(&str); - my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), str.c_ptr()); + my_error(ER_ERROR_EVALUATING_EXPRESSION, MYF(0), str.c_ptr_safe()); DBUG_RETURN(1); } @@ -2881,9 +2883,11 @@ static bool fix_and_check_vcol_expr(THD *thd, TABLE *table, of the statement because the field item does not have a field pointer at that time */ - my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(0), + myf warn= table->s->frm_version < FRM_VER_EXPRESSSIONS ? ME_JUST_WARNING : 0; + my_error(ER_VIRTUAL_COLUMN_FUNCTION_IS_NOT_ALLOWED, MYF(warn), "AUTO_INCREMENT", vcol->get_vcol_type_name(), res.name); - DBUG_RETURN(1); + if (!warn) + DBUG_RETURN(1); } vcol->flags= res.errors; @@ -4502,16 +4506,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl) DBUG_ASSERT(!file->keyread_enabled()); - /* mark the record[0] uninitialized */ - TRASH_ALLOC(record[0], s->reclength); - - /* - Initialize the null marker bits, to ensure that if we are doing a read - of only selected columns (like in keyread), all null markers are - initialized. - */ - memset(record[0], 255, s->null_bytes); - memset(record[1], 255, s->null_bytes); + restore_record(this, s->default_values); /* Tables may be reused in a sub statement. */ DBUG_ASSERT(!file->extra(HA_EXTRA_IS_ATTACHED_CHILDREN)); |