List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:September 21 2009 12:25pm
Subject:bzr commit into mysql-6.0-bugfixing branch (tor.didriksen:2828) Bug#46606
View as plain text  
#At file:///export/home/didrik/mysqldev-6.0-codebase/6.0-codebase-bf-bug46606/ based on revid:epotemkin@stripped

 2828 Tor Didriksen	2009-09-21 [merge]
      Bug#46606  	Casting error for large numbers in 5.4 when 'div' is used
      
      DIV queries which are out of range will generate an error: Error (Code 1264): Out of range value
      Prior to this fix, they would also generate an: Error (Code 1041): Out of memory; 
     @ mysql-test/r/func_math.result
        Use SHOW WARNINGS to verify the expected warnings/errors.
     @ mysql-test/t/func_math.test
        Use SHOW WARNINGS to verify the expected warnings/errors.
     @ sql/protocol.cc
        Item::send() may generate an error.
        If so, abort the loop without generating the ER_OUT_OF_RESOURCES error.

    modified:
      mysql-test/r/func_math.result
      mysql-test/t/func_math.test
      sql/protocol.cc
=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2009-09-16 08:23:16 +0000
+++ b/mysql-test/r/func_math.result	2009-09-21 12:24:53 +0000
@@ -492,4 +492,8 @@ select 123456789012345678901234567890.12
 ERROR 22003: Out of range value for column 'x' at row 1
 select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;
 ERROR 22003: Out of range value for column 'x' at row 1
+SHOW WARNINGS;
+Level	Code	Message
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Error	1264	Out of range value for column 'x' at row 1
 End of 6.0 tests

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2009-09-16 08:23:16 +0000
+++ b/mysql-test/t/func_math.test	2009-09-21 12:24:53 +0000
@@ -312,12 +312,14 @@ DROP TABLE t1;
 --echo End of 5.1 tests
 
 #
-# Bug #8457: Precision math: DIV returns incorrect result with large decimal value
-#
+# Bug #8457: Precision math:
+#            DIV returns incorrect result with large decimal value
+# Bug #46606:Casting error for large numbers in 5.4 when 'div' is used
 
 --error ER_WARN_DATA_OUT_OF_RANGE
 select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
 --error ER_WARN_DATA_OUT_OF_RANGE
 select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x; 
+SHOW WARNINGS;
 
 --echo End of 6.0 tests

=== modified file 'sql/protocol.cc'
--- a/sql/protocol.cc	2009-07-30 16:22:41 +0000
+++ b/sql/protocol.cc	2009-09-21 12:24:53 +0000
@@ -827,12 +827,16 @@ bool Protocol::send_result_set_row(List<
 
   for (Item *item= it++; item; item= it++)
   {
-    if (item->send(this, &str_buffer) || thd->is_error())
+    if (item->send(this, &str_buffer))
     {
-      this->free();				// Free used buffer
-      my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
+      // If we're out of memory, reclaim some, to help us recover.
+      this->free();
       DBUG_RETURN(TRUE);
     }
+    // Item::send() may generate an error. If so, abort the loop.
+    if (thd->is_error())
+      DBUG_RETURN(TRUE);
+
     /*
       Reset str_buffer to its original state, as it may have been altered in
       Item::send().


Attachment: [text/bzr-bundle] bzr/tor.didriksen@sun.com-20090921122453-zmkctioq5zxut4z3.bundle
Thread
bzr commit into mysql-6.0-bugfixing branch (tor.didriksen:2828) Bug#46606Tor Didriksen21 Sep