Commit d3008173 authored by unknown's avatar unknown
Browse files

Fix for bug #13667 (Inconsistency for decimal(m,d) specification.


mysql-test/r/type_newdecimal.result:
  result fixed
mysql-test/t/type_newdecimal.test:
  testcase added
sql/sql_parse.cc:
  we should check if 'decimals' is not null
parent d471e9de
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1019,3 +1019,5 @@ drop procedure wg2;
select cast(@non_existing_user_var/2 as DECIMAL);
cast(@non_existing_user_var/2 as DECIMAL)
NULL
create table t (d decimal(0,10));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'd').
+6 −0
Original line number Diff line number Diff line
@@ -1044,3 +1044,9 @@ drop procedure wg2;
#

select cast(@non_existing_user_var/2 as DECIMAL);

#
# Bug #13667 (Inconsistency for decimal(m,d) specification
#
--error 1427
create table t (d decimal(0,10));
+1 −1
Original line number Diff line number Diff line
@@ -5748,7 +5748,7 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
  case FIELD_TYPE_NULL:
    break;
  case FIELD_TYPE_NEWDECIMAL:
    if (!length)
    if (!length && !new_field->decimals)
      new_field->length= 10;
    if (new_field->length > DECIMAL_MAX_PRECISION)
    {