List:Commits« Previous MessageNext Message »
From:gluh Date:July 31 2006 11:41am
Subject:bk commit into 5.0 tree (gluh:1.2226) BUG#16172
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gluh. When gluh 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@stripped, 2006-07-31 16:41:46+05:00, gluh@stripped +4 -0
  Bug#16172 DECIMAL data type processed incorrectly
  issue an error in case of DECIMAL(M,N) if N > M

  mysql-test/r/type_newdecimal.result@stripped, 2006-07-31 16:41:41+05:00, gluh@stripped +5 -1
    Bug#16172 DECIMAL data type processed incorrectly
    result fix & test case

  mysql-test/t/type_newdecimal.test@stripped, 2006-07-31 16:41:41+05:00, gluh@stripped +6 -2
    Bug#16172 DECIMAL data type processed incorrectly
    test fix

  sql/item_create.cc@stripped, 2006-07-31 16:41:41+05:00, gluh@stripped +8 -1
    Bug#16172 DECIMAL data type processed incorrectly
    issue an error in case of DECIMAL(M,N) if N > M

  sql/sql_yacc.yy@stripped, 2006-07-31 16:41:41+05:00, gluh@stripped +4 -0
    Bug#16172 DECIMAL data type processed incorrectly
    issue an error in case of DECIMAL(M,N) if N > M

# 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:	gluh
# Host:	gluh.(none)
# Root:	/home/gluh/MySQL/Bugs/5.0.16172

--- 1.60/sql/item_create.cc	2006-07-31 16:41:55 +05:00
+++ 1.61/sql/item_create.cc	2006-07-31 16:41:55 +05:00
@@ -450,6 +450,7 @@
 		       CHARSET_INFO *cs)
 {
   Item *res;
+  int tmp_len;
   LINT_INIT(res);
 
   switch (cast_type) {
@@ -460,7 +461,13 @@
   case ITEM_CAST_TIME:		res= new Item_time_typecast(a); break;
   case ITEM_CAST_DATETIME:	res= new Item_datetime_typecast(a); break;
   case ITEM_CAST_DECIMAL:
-    res= new Item_decimal_typecast(a, (len>0) ? len : 10, dec ? dec : 2);
+    tmp_len= (len>0) ? len : 10;
+    if (tmp_len < dec)
+    {
+      my_error(ER_M_BIGGER_THAN_D, MYF(0), "");
+      return 0;
+    }
+    res= new Item_decimal_typecast(a, tmp_len, dec ? dec : 2);
     break;
   case ITEM_CAST_CHAR:
     res= new Item_char_typecast(a, len, cs ? cs : 

--- 1.475/sql/sql_yacc.yy	2006-07-31 16:41:55 +05:00
+++ 1.476/sql/sql_yacc.yy	2006-07-31 16:41:55 +05:00
@@ -4344,6 +4344,8 @@
                                  lex->length ? atoi(lex->length) : -1,
                                  lex->dec ? atoi(lex->dec) : 0,
                                  lex->charset);
+            if (!$$)
+              YYABORT;
 	  }
 	| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
 	  { $$= new Item_func_case(* $4, $2, $5 ); }
@@ -4353,6 +4355,8 @@
 				 Lex->length ? atoi(Lex->length) : -1,
                                  Lex->dec ? atoi(Lex->dec) : 0,
 				 Lex->charset);
+            if (!$$)
+              YYABORT;
 	  }
 	| CONVERT_SYM '(' expr USING charset_name ')'
 	  { $$= new Item_func_conv_charset($3,$5); }

--- 1.40/mysql-test/r/type_newdecimal.result	2006-07-31 16:41:55 +05:00
+++ 1.41/mysql-test/r/type_newdecimal.result	2006-07-31 16:41:55 +05:00
@@ -915,9 +915,13 @@
 select cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15));
 cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
 0.000000000100000
-select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
+select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
 c1	c2	c3
 9.5468126085974	9.547	9.547
+select convert(ln(14000),decimal(2,3)) c1;
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
+select cast(ln(14000) as decimal(2,3)) c1;
+ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
 create table t1 (sl decimal(70,30));
 ERROR 42000: Too big precision 70 specified for column 'sl'. Maximum is 65.
 create table t1 (sl decimal(32,31));

--- 1.37/mysql-test/t/type_newdecimal.test	2006-07-31 16:41:55 +05:00
+++ 1.38/mysql-test/t/type_newdecimal.test	2006-07-31 16:41:55 +05:00
@@ -947,8 +947,12 @@
 #
 # Bug #11708 (conversion to decimal fails in decimal part)
 #
-select ln(14000) c1, convert(ln(14000),decimal(2,3)) c2, cast(ln(14000) as decimal(2,3)) c3;
-
+select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
+--error 1427
+select convert(ln(14000),decimal(2,3)) c1;
+--error 1427
+select cast(ln(14000) as decimal(2,3)) c1;
+ 
 #
 # Bug #8449 (Silent column changes)
 #
Thread
bk commit into 5.0 tree (gluh:1.2226) BUG#16172gluh31 Jul