List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:September 23 2010 12:38pm
Subject:bzr commit into mysql-5.5-bugfixing branch (mats.kindahl:3203)
View as plain text  
#At file:///home/bzr/bugs/b52171-5.5-bugfixing/ based on revid:mats.kindahl@stripped

 3203 Mats Kindahl	2010-09-23
      Merging into mysql-5.5-bugfixing.

    modified:
      mysql-test/r/type_newdecimal.result
      mysql-test/t/type_newdecimal.test
      sql/field.cc
=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result	2010-04-11 06:52:42 +0000
+++ b/mysql-test/r/type_newdecimal.result	2010-09-23 12:38:24 +0000
@@ -1908,4 +1908,16 @@ group by PAY.id + 1;
 mult	v_net_with_discount	v_total
 1.0000	27.18	27.180000
 DROP TABLE currencies, payments, sub_tasks;
+#
+# BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
+#
+CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
+INSERT INTO t1 VALUES (0);
+SELECT AVG(DISTINCT a) FROM t1;
+AVG(DISTINCT a)
+0.00000000
+SELECT SUM(DISTINCT a) FROM t1;
+SUM(DISTINCT a)
+0.0000
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test	2010-04-11 06:52:42 +0000
+++ b/mysql-test/t/type_newdecimal.test	2010-09-23 12:38:24 +0000
@@ -1509,5 +1509,14 @@ group by PAY.id + 1;
 
 DROP TABLE currencies, payments, sub_tasks;
 
+--echo #
+--echo # BUG#52171: distinct aggregates on unsigned decimal fields trigger assertions
+--echo #
+
+CREATE TABLE t1 (a DECIMAL(4,4) UNSIGNED);
+INSERT INTO t1 VALUES (0);
+SELECT AVG(DISTINCT a) FROM t1;
+SELECT SUM(DISTINCT a) FROM t1;
+DROP TABLE t1;
 
 --echo End of 5.1 tests

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-08-23 09:56:21 +0000
+++ b/sql/field.cc	2010-09-23 12:38:24 +0000
@@ -9104,7 +9104,7 @@ void Create_field::init_for_tmp_table(en
   case MYSQL_TYPE_NEWDECIMAL:
   case MYSQL_TYPE_FLOAT:
   case MYSQL_TYPE_DOUBLE:
-    pack_flag= FIELDFLAG_DECIMAL | FIELDFLAG_NUMBER |
+    pack_flag= FIELDFLAG_NUMBER |
       (decimals_arg & FIELDFLAG_MAX_DEC) << FIELDFLAG_DEC_SHIFT;
     break;
 
@@ -9153,12 +9153,13 @@ void Create_field::init_for_tmp_table(en
     (maybe_null ? FIELDFLAG_MAYBE_NULL : 0) |
     (is_unsigned ? 0 : FIELDFLAG_DECIMAL);
 
-  DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s, pack_type: %d",
+  DBUG_PRINT("debug", ("pack_flag: %s%s%s%s%s%s, pack_type: %d",
                        FLAGSTR(pack_flag, FIELDFLAG_BINARY),
                        FLAGSTR(pack_flag, FIELDFLAG_NUMBER),
                        FLAGSTR(pack_flag, FIELDFLAG_INTERVAL),
                        FLAGSTR(pack_flag, FIELDFLAG_GEOM),
                        FLAGSTR(pack_flag, FIELDFLAG_BLOB),
+                       FLAGSTR(pack_flag, FIELDFLAG_DECIMAL),
                        f_packtype(pack_flag)));
   DBUG_VOID_RETURN;
 }


Attachment: [text/bzr-bundle] bzr/mats.kindahl@oracle.com-20100923123824-1755fy9wcv22qfd5.bundle
Thread
bzr commit into mysql-5.5-bugfixing branch (mats.kindahl:3203) Mats Kindahl23 Sep