List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:September 19 2005 11:19pm
Subject:bk commit into 5.0 tree (jimw:1.1984) BUG#11102
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1984 05/09/19 16:19:38 jimw@stripped +3 -0
  Fail when trying to create a FLOAT or DOUBLE column with the number of
  digits after the decimal point greater than the total number of digits
  in the field. (Bug #11102)

  sql/sql_parse.cc
    1.489 05/09/19 16:19:35 jimw@stripped +10 -0
    Generate ER_SCALE_BIGGER_THAN_PRECISION errors for FLOAT and DOUBLE.

  mysql-test/t/type_float.test
    1.23 05/09/19 16:19:35 jimw@stripped +11 -0
    Add new regression test

  mysql-test/r/type_float.result
    1.39 05/09/19 16:19:35 jimw@stripped +4 -0
    New results

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-11102

--- 1.488/sql/sql_parse.cc	2005-09-14 11:44:43 -07:00
+++ 1.489/sql/sql_parse.cc	2005-09-19 16:19:35 -07:00
@@ -5765,6 +5765,11 @@
   case FIELD_TYPE_FLOAT:
     /* change FLOAT(precision) to FLOAT or DOUBLE */
     allowed_type_modifier= AUTO_INCREMENT_FLAG;
+    if (decimals && length && new_field->length < new_field->decimals)
+    {
+      my_error(ER_SCALE_BIGGER_THAN_PRECISION, MYF(0), field_name);
+      DBUG_RETURN(NULL);
+    }
     if (length && !decimals)
     {
       uint tmp_length=new_field->length;
@@ -5791,6 +5796,11 @@
     break;
   case FIELD_TYPE_DOUBLE:
     allowed_type_modifier= AUTO_INCREMENT_FLAG;
+    if (decimals && length && new_field->length < new_field->decimals)
+    {
+      my_error(ER_SCALE_BIGGER_THAN_PRECISION, MYF(0), field_name);
+      DBUG_RETURN(NULL);
+    }
     if (!length)
     {
       new_field->length = DBL_DIG+7;

--- 1.38/mysql-test/r/type_float.result	2005-07-07 09:47:13 -07:00
+++ 1.39/mysql-test/r/type_float.result	2005-09-19 16:19:35 -07:00
@@ -225,3 +225,7 @@
 reckey	recdesc
 109	Has 109 as key
 drop table t1;
+create table t1 (f float(3,6));
+ERROR 42000: Scale may not be larger than the precision (column 'f').
+create table t1 (f double(3,6));
+ERROR 42000: Scale may not be larger than the precision (column 'f').

--- 1.22/mysql-test/t/type_float.test	2005-07-28 06:12:37 -07:00
+++ 1.23/mysql-test/t/type_float.test	2005-09-19 16:19:35 -07:00
@@ -147,3 +147,14 @@
 drop table t1;
 
 # End of 4.1 tests
+
+#
+# Bug #11102: Need to error on a float or double column definition that is
+# not valid
+#
+--error 1427
+create table t1 (f float(3,6));
+--error 1427
+create table t1 (f double(3,6));
+
+# End of 5.0 tests
Thread
bk commit into 5.0 tree (jimw:1.1984) BUG#11102Jim Winstead20 Sep