List:Commits« Previous MessageNext Message »
From:ramil Date:October 4 2007 4:22pm
Subject:bk commit into 5.0 tree (ramil:1.2528) BUG#31249
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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, 2007-10-04 21:21:58+05:00, ramil@stripped +3 -0
  Fix for bug #31249: Assertion `!table || (!table->write_set || 
  bitmap_is_set(table->write_set, fiel
  
  Problem: creating a temporary table we allocate the group buffer if needed
  followed by table bitmaps (see create_tmp_table()). Reserving less memory for 
  the group buffer than actually needed (used) for values retrieval may lead 
  to overlapping with followed bitmaps in the memory pool that in turn leads 
  to unpredictable consequences.
  
  As we use Item->max_length sometimes to calculate group buffer size,
  it must be set to proper value. In this particular case 
  Item_datetime_typecast::max_length is too small.
  
  Fix: set Item_datetime_typecast::max_length properly.

  mysql-test/r/type_datetime.result@stripped, 2007-10-04 21:21:57+05:00, ramil@stripped +14 -0
    Fix for bug #31249: Assertion `!table || (!table->write_set || 
    bitmap_is_set(table->write_set, fiel
      - test result.

  mysql-test/t/type_datetime.test@stripped, 2007-10-04 21:21:57+05:00, ramil@stripped +13 -0
    Fix for bug #31249: Assertion `!table || (!table->write_set || 
    bitmap_is_set(table->write_set, fiel
      - test case.

  sql/item_timefunc.h@stripped, 2007-10-04 21:21:57+05:00, ramil@stripped +3 -1
    Fix for bug #31249: Assertion `!table || (!table->write_set || 
    bitmap_is_set(table->write_set, fiel
      - set Item_datetime_typecast::max_length properly.

diff -Nrup a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
--- a/mysql-test/r/type_datetime.result	2007-06-06 01:25:01 +05:00
+++ b/mysql-test/r/type_datetime.result	2007-10-04 21:21:57 +05:00
@@ -427,3 +427,17 @@ f1
 Warnings:
 Warning	1292	Incorrect datetime value: '2007010100000' for column 'f1' at row 1
 drop table t1;
+create table t1 (a tinyint);
+insert into t1 values (), (), ();
+select sum(a) from t1 group by convert(a, datetime);
+sum(a)
+NULL
+select convert(a, datetime) from t1;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def					convert(a, datetime)	12	29	0	Y	128	6	63
+convert(a, datetime)
+NULL
+NULL
+NULL
+drop table t1;
+End of 5.0 tests
diff -Nrup a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
--- a/mysql-test/t/type_datetime.test	2007-06-06 01:25:02 +05:00
+++ b/mysql-test/t/type_datetime.test	2007-10-04 21:21:57 +05:00
@@ -282,3 +282,16 @@ select * from t1 where f1 between 200201
 select * from t1 where f1 between 2002010 and 20070101000000;
 select * from t1 where f1 between 20020101 and 2007010100000;
 drop table t1;
+
+#
+# Bug #31249: problem with convert(..., datetime)
+#
+create table t1 (a tinyint);
+insert into t1 values (), (), ();
+select sum(a) from t1 group by convert(a, datetime);
+--enable_metadata
+select convert(a, datetime) from t1;
+--disable_metadata
+drop table t1;
+
+--echo End of 5.0 tests
diff -Nrup a/sql/item_timefunc.h b/sql/item_timefunc.h
--- a/sql/item_timefunc.h	2007-05-16 13:44:40 +05:00
+++ b/sql/item_timefunc.h	2007-10-04 21:21:57 +05:00
@@ -844,7 +844,9 @@ public:
   enum_field_types field_type() const { return MYSQL_TYPE_DATETIME; }
   void fix_length_and_dec()
   {
-    Item_typecast_maybe_null::fix_length_and_dec();
+    collation.set(&my_charset_bin);
+    maybe_null= 1;
+    max_length= MAX_DATETIME_FULL_WIDTH * MY_CHARSET_BIN_MB_MAXLEN;
     decimals= DATETIME_DEC;
   }
 
Thread
bk commit into 5.0 tree (ramil:1.2528) BUG#31249ramil4 Oct