List:Commits« Previous MessageNext Message »
From:kgeorge Date:September 19 2007 3:09pm
Subject:bk commit into 5.0 tree (gkodinov:1.2529) BUG#30587
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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-09-19 17:08:56+02:00, gkodinov@stripped +3 -0
  Bug #30587: mysql crashes when trying to group by TIME div NUMBER
  
  The Field_timestamp class was not returning correct information 
  about the number of decimals. It was returning the default number 
  for Field_str, that was wrong. 
  This caused an excessive amount of memory to be allocated for the 
  field's buffer and crashed the server.
  
   
  Fixed by returning a correct number of decimals for a timestamp field.

  mysql-test/r/type_timestamp.result@stripped, 2007-09-19 17:08:47+02:00, gkodinov@stripped +8 -0
    Bug #30587: test case

  mysql-test/t/type_timestamp.test@stripped, 2007-09-19 17:08:48+02:00, gkodinov@stripped +11 -0
    Bug #30587: test case

  sql/field.h@stripped, 2007-09-19 17:08:49+02:00, gkodinov@stripped +1 -0
    Bug #30587: Return a correct number of decimals for a timestamp field

diff -Nrup a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
--- a/mysql-test/r/type_timestamp.result	2006-12-13 10:17:38 +01:00
+++ b/mysql-test/r/type_timestamp.result	2007-09-19 17:08:47 +02:00
@@ -508,3 +508,11 @@ select is_nullable from INFORMATION_SCHE
 is_nullable
 NO
 drop table t1;
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES(NOW()), (NOW());
+SELECT a DIV 900 b FROM t1 GROUP BY b;
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def				b	b	8	19	11	Y	32800	0	63
+b
+22234343382
+DROP TABLE t1;
diff -Nrup a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
--- a/mysql-test/t/type_timestamp.test	2006-08-08 10:34:23 +02:00
+++ b/mysql-test/t/type_timestamp.test	2007-09-19 17:08:48 +02:00
@@ -339,3 +339,14 @@ PRIMARY KEY (`id`)
 show fields from t1;
 select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
 drop table t1;
+
+#
+# Bug #30587: mysql crashes when trying to group by TIME div NUMBER
+#
+
+CREATE TABLE t1 (a TIMESTAMP);
+INSERT INTO t1 VALUES(NOW()), (NOW());
+--enable_metadata
+SELECT a DIV 900 b FROM t1 GROUP BY b;
+--disable_metadata
+DROP TABLE t1;
diff -Nrup a/sql/field.h b/sql/field.h
--- a/sql/field.h	2007-08-06 02:12:52 +02:00
+++ b/sql/field.h	2007-09-19 17:08:49 +02:00
@@ -847,6 +847,7 @@ public:
   enum_field_types type() const { return FIELD_TYPE_TIMESTAMP;}
   enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
   enum Item_result cmp_type () const { return INT_RESULT; }
+  uint decimals() const { return 0; }
   int  store(const char *to,uint length,CHARSET_INFO *charset);
   int  store(double nr);
   int  store(longlong nr, bool unsigned_val);
Thread
bk commit into 5.0 tree (gkodinov:1.2529) BUG#30587kgeorge19 Sep