Commit f6b2b7a4 authored by unknown's avatar unknown

Merging


sql/sql_parse.cc:
  Auto merged
parents ddd18a89 eaba3ed3
...@@ -225,3 +225,7 @@ select * from t1 where reckey=1.09E2; ...@@ -225,3 +225,7 @@ select * from t1 where reckey=1.09E2;
reckey recdesc reckey recdesc
109 Has 109 as key 109 Has 109 as key
drop table t1; drop table t1;
create table t1 (s1 float(0,2));
ERROR 42000: For float(M,D) or double(M,D), M must be >= D (column 's1').
create table t1 (s1 float(1,2));
ERROR 42000: For float(M,D) or double(M,D), M must be >= D (column 's1').
...@@ -147,3 +147,12 @@ select * from t1 where reckey=1.09E2; ...@@ -147,3 +147,12 @@ select * from t1 where reckey=1.09E2;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
#
# bug #12694 (float(m,d) specifications)
#
--error 1443
create table t1 (s1 float(0,2));
--error 1443
create table t1 (s1 float(1,2));
...@@ -5419,3 +5419,5 @@ ER_ROW_IS_REFERENCED_2 23000 ...@@ -5419,3 +5419,5 @@ ER_ROW_IS_REFERENCED_2 23000
eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)" eng "Cannot delete or update a parent row: a foreign key constraint fails (%.192s)"
ER_NO_REFERENCED_ROW_2 23000 ER_NO_REFERENCED_ROW_2 23000
eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)" eng "Cannot add or update a child row: a foreign key constraint fails (%.192s)"
ER_M_BIGGER_THAN_D 42000 S1009
eng "For float(M,D) or double(M,D), M must be >= D (column '%-.64s')."
...@@ -5814,19 +5814,31 @@ new_create_field(THD *thd, char *field_name, enum_field_types type, ...@@ -5814,19 +5814,31 @@ new_create_field(THD *thd, char *field_name, enum_field_types type,
new_field->decimals= NOT_FIXED_DEC; new_field->decimals= NOT_FIXED_DEC;
break; break;
} }
if (!length) if (!length && !decimals)
{ {
new_field->length = FLT_DIG+6; new_field->length = FLT_DIG+6;
new_field->decimals= NOT_FIXED_DEC; new_field->decimals= NOT_FIXED_DEC;
} }
if (new_field->length < new_field->decimals &&
new_field->decimals != NOT_FIXED_DEC)
{
my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name);
DBUG_RETURN(NULL);
}
break; break;
case FIELD_TYPE_DOUBLE: case FIELD_TYPE_DOUBLE:
allowed_type_modifier= AUTO_INCREMENT_FLAG; allowed_type_modifier= AUTO_INCREMENT_FLAG;
if (!length) if (!length && !decimals)
{ {
new_field->length = DBL_DIG+7; new_field->length = DBL_DIG+7;
new_field->decimals=NOT_FIXED_DEC; new_field->decimals=NOT_FIXED_DEC;
} }
if (new_field->length < new_field->decimals &&
new_field->decimals != NOT_FIXED_DEC)
{
my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name);
DBUG_RETURN(NULL);
}
break; break;
case FIELD_TYPE_TIMESTAMP: case FIELD_TYPE_TIMESTAMP:
if (!length) if (!length)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment