List:Commits« Previous MessageNext Message »
From:Tatiana A. Nurnberg Date:January 30 2009 5:22pm
Subject:bzr commit into mysql-6.0-bugteam branch (azundris:2961)
View as plain text  
#At file:///misc/mysql/forest/41370/60-41370/ based on revid:davi.arnaut@stripped

 2961 Tatiana A. Nurnberg	2009-01-30 [merge]
      auto-merge
modified:
  mysql-test/r/type_timestamp.result
  mysql-test/t/type_timestamp.test
  sql/item.cc

=== modified file 'mysql-test/r/type_timestamp.result'
--- a/mysql-test/r/type_timestamp.result	2007-11-14 13:54:18 +0000
+++ b/mysql-test/r/type_timestamp.result	2009-01-30 17:12:49 +0000
@@ -484,6 +484,7 @@ a	b	c
 5	NULL	2001-09-09 04:46:59
 6	NULL	2006-06-06 06:06:06
 drop table t1;
+End of 4.1 tests
 set time_zone= @@global.time_zone;
 CREATE TABLE t1 (
 `id` int(11) NOT NULL auto_increment,
@@ -500,3 +501,21 @@ select is_nullable from INFORMATION_SCHE
 is_nullable
 NO
 drop table t1;
+CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+f3 TIMESTAMP);
+INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
+INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
+INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
+INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
+INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
+UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
+SELECT f1,f2-f3 FROM t1;
+f1	f2-f3
+1	0
+2	0
+3	0
+4	0
+5	0
+DROP TABLE t1;
+End of 5.0 tests

=== modified file 'mysql-test/t/type_timestamp.test'
--- a/mysql-test/t/type_timestamp.test	2007-05-05 20:03:19 +0000
+++ b/mysql-test/t/type_timestamp.test	2009-01-30 17:12:49 +0000
@@ -324,7 +324,7 @@ insert into t1 (a, c) values (4, '2004-0
 select * from t1;
 drop table t1;
 
-# End of 4.1 tests
+--echo End of 4.1 tests
 
 # Restore timezone to default
 set time_zone= @@global.time_zone;
@@ -339,3 +339,21 @@ 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#41370: TIMESTAMP field does not accepts NULL from FROM_UNIXTIME()
+#
+
+CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                  f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+                  f3 TIMESTAMP);
+INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
+INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
+INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
+INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
+INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
+UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
+SELECT f1,f2-f3 FROM t1;
+DROP TABLE t1;
+
+--echo End of 5.0 tests

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2009-01-06 16:52:32 +0000
+++ b/sql/item.cc	2009-01-30 17:12:49 +0000
@@ -325,7 +325,7 @@ int Item::save_time_in_field(Field *fiel
 {
   MYSQL_TIME ltime;
   if (get_time(&ltime))
-    return set_field_to_null(field);
+    return set_field_to_null_with_conversions(field, 0);
   field->set_notnull();
   return field->store_time(&ltime, MYSQL_TIMESTAMP_TIME);
 }
@@ -335,7 +335,7 @@ int Item::save_date_in_field(Field *fiel
 {
   MYSQL_TIME ltime;
   if (get_date(&ltime, TIME_FUZZY_DATE))
-    return set_field_to_null(field);
+    return set_field_to_null_with_conversions(field, 0);
   field->set_notnull();
   return field->store_time(&ltime, MYSQL_TIMESTAMP_DATETIME);
 }

Thread
bzr commit into mysql-6.0-bugteam branch (azundris:2961) Tatiana A. Nurnberg30 Jan