List:Internals« Previous MessageNext Message »
From:holyfoot Date:August 25 2005 2:21pm
Subject:bk commit into 5.0 tree (hf:1.1916) BUG#12694
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf 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.1916 05/08/25 19:21:47 hf@deer.(none) +2 -0
  Fix for bug #12694 (float(1,2) field error)

  sql/sql_parse.cc
    1.474 05/08/25 19:20:40 hf@deer.(none) +14 -2
    length & dec checks added

  mysql-test/t/type_float.test
    1.23 05/08/25 19:20:40 hf@deer.(none) +9 -0
    test case

# 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:	hf
# Host:	deer.(none)
# Root:	/home/hf/work/mysql-5.0.12694

--- 1.473/sql/sql_parse.cc	Wed Aug 24 04:43:16 2005
+++ 1.474/sql/sql_parse.cc	Thu Aug 25 19:20:40 2005
@@ -5752,18 +5752,30 @@
       new_field->decimals= NOT_FIXED_DEC;
       break;
     }
-    if (!length)
+    if (!length && !decimals)
     {
       new_field->length =  FLT_DIG+6;
       new_field->decimals= NOT_FIXED_DEC;
     }
+    if (new_field->length < new_field->decimals &&
+        new_field->decimals != NOT_FIXED_DEC)
+    {
+      my_error(ER_SCALE_BIGGER_THAN_PRECISION, MYF(0), field_name);
+      DBUG_RETURN(NULL);
+    }
     break;
   case FIELD_TYPE_DOUBLE:
     allowed_type_modifier= AUTO_INCREMENT_FLAG;
-    if (!length)
+    if (!length && !decimals)
     {
       new_field->length = DBL_DIG+7;
       new_field->decimals=NOT_FIXED_DEC;
+    }
+    if (new_field->length < new_field->decimals &&
+        new_field->decimals != NOT_FIXED_DEC)
+    {
+      my_error(ER_SCALE_BIGGER_THAN_PRECISION, MYF(0), field_name);
+      DBUG_RETURN(NULL);
     }
     break;
   case FIELD_TYPE_TIMESTAMP:

--- 1.22/mysql-test/t/type_float.test	Thu Jul 28 18:12:37 2005
+++ 1.23/mysql-test/t/type_float.test	Thu Aug 25 19:20:40 2005
@@ -147,3 +147,12 @@
 drop table t1;
 
 # End of 4.1 tests
+
+#
+# bug #12694 (float(m,d) specifications)
+#
+
+--error 1427
+create table t1 (s1 float(0,2));
+--error 1427
+create table t1 (s1 float(1,2));
Thread
bk commit into 5.0 tree (hf:1.1916) BUG#12694holyfoot25 Aug