summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/type_newdecimal.result2
-rw-r--r--mysql-test/t/type_newdecimal.test6
-rw-r--r--sql/sql_parse.cc2
3 files changed, 9 insertions, 1 deletions
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index be5e29ab662..dbae646c362 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -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').
diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
index 3f04aa931d2..a7087d46dca 100644
--- a/mysql-test/t/type_newdecimal.test
+++ b/mysql-test/t/type_newdecimal.test
@@ -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));
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index d0585dd1a65..33020fccd8e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5791,7 +5791,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)
{