summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-06-26 16:26:35 +0200
committerSergei Golubchik <serg@mariadb.org>2017-07-05 17:15:58 +0200
commit47687eef41b97edac423b4ff694cdd20cf804901 (patch)
treed3a42270de568e1b78ed318c26903218c5372ea8 /sql/table.cc
parent75f80004b165363b10eeb9b63c342215356c98d0 (diff)
downloadmariadb-git-47687eef41b97edac423b4ff694cdd20cf804901.tar.gz
MDEV-12936 upgrade to 10.2.6 failed upon tables with virtual columns
when opening 10.1- table that has virtual columns: 1. don't error out if it has vcols over autoinc columns. just issue a warning. 2. set vcol type properly 3. in innodb: use table->s->stored_fields instead of table->s->fields, because that's what was stored in innodb data dictionary
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 10a94dd8212..45a2966407a 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1860,7 +1860,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
@@ -2862,9 +2864,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;