From c3e06381ab67cb8c45dbed466fcce3ea976441bb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 1 Jul 2016 21:47:40 +0200 Subject: [PATCH] cannot use item->const_item() in open_table_from_share() because table->map is set much later. Use check_vcol_func_processor() to detect fields too. --- sql/item.h | 4 ++++ sql/table.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sql/item.h b/sql/item.h index d31660e5b16cb..2e0afe1ce1a05 100644 --- a/sql/item.h +++ b/sql/item.h @@ -2511,6 +2511,10 @@ class Item_field :public Item_ident bool enumerate_field_refs_processor(void *arg); bool update_table_bitmaps_processor(void *arg); bool switch_to_nullable_fields_processor(void *arg); + bool check_vcol_func_processor(void *arg) + { // may be, a special flag VCOL_FIELD ? + return mark_unsupported_function(field_name, arg, VCOL_UNKNOWN); + } void cleanup(); Item_equal *get_item_equal() { return item_equal; } void set_item_equal(Item_equal *item_eq) { item_equal= item_eq; } diff --git a/sql/table.cc b/sql/table.cc index d4adb5ca35614..4fc128dba010a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3041,8 +3041,8 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, goto err; } field->default_value= vcol; - if (is_create_table && vcol->expr_item->const_item() && - !(vcol->flags & (VCOL_NON_DETERMINISTIC | VCOL_TIME_FUNC))) + if (is_create_table && + !(vcol->flags & (VCOL_UNKNOWN | VCOL_NON_DETERMINISTIC | VCOL_TIME_FUNC))) { enum_check_fields old_count_cuted_fields= thd->count_cuted_fields; thd->count_cuted_fields= CHECK_FIELD_WARN; // To find wrong default values