diff options
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index 20041b1176a..fa15b992e5c 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -2326,7 +2326,7 @@ Item* Create_qfunc::create(THD *thd, LEX_STRING name, List<Item> *item_list) { LEX_STRING db; - if (thd->copy_db_to(&db.str, &db.length)) + if (thd->lex->copy_db_to(&db.str, &db.length)) return NULL; return create(thd, db, name, false, item_list); @@ -5039,6 +5039,18 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, my_error(ER_M_BIGGER_THAN_D, MYF(0), ""); return 0; } + if (len > DECIMAL_MAX_PRECISION) + { + my_error(ER_TOO_BIG_PRECISION, MYF(0), len, a->name, + DECIMAL_MAX_PRECISION); + return 0; + } + if (dec > DECIMAL_MAX_SCALE) + { + my_error(ER_TOO_BIG_SCALE, MYF(0), dec, a->name, + DECIMAL_MAX_SCALE); + return 0; + } res= new (thd->mem_root) Item_decimal_typecast(a, len, dec); break; } |