summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorramil/ram@mysql.com/myoffice.izhnet.ru <>2006-07-23 14:17:01 +0500
committerramil/ram@mysql.com/myoffice.izhnet.ru <>2006-07-23 14:17:01 +0500
commit694d4999ef5a30053aa29f188c1617bf3fcc568c (patch)
treeb211feabcc6fab041d6cb19a25bab48d948e91b7
parent95b88445fbf9cbd20efe25972123029ca679b121 (diff)
parent7319ef4ef15726590fe3083233956540196e1345 (diff)
downloadmariadb-git-694d4999ef5a30053aa29f188c1617bf3fcc568c.tar.gz
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/ram/work/4.1.b16327
-rw-r--r--mysql-test/r/func_time.result7
-rw-r--r--mysql-test/t/func_time.test10
-rw-r--r--sql/field.cc2
3 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index fab0bf01f58..d8ba606a558 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -636,6 +636,13 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
NULL NULL January NULL
+set time_zone='-6:00';
+create table t1(a timestamp);
+insert into t1 values (19691231190001);
+select * from t1;
+a
+1969-12-31 19:00:01
+drop table t1;
create table t1(f1 date, f2 time, f3 datetime);
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index b232fb14e1e..b8647a281d4 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -329,6 +329,16 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
#
+# Bug #16327: problem with timestamp < 1970
+#
+
+set time_zone='-6:00';
+create table t1(a timestamp);
+insert into t1 values (19691231190001);
+select * from t1;
+drop table t1;
+
+#
# Bug#16377 result of DATE/TIME functions were compared as strings which
# can lead to a wrong result.
#
diff --git a/sql/field.cc b/sql/field.cc
index 3cb0c0d3a7c..39d19dc39bc 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -3809,7 +3809,7 @@ String *Field_timestamp::val_str(String *val_buffer, String *val_ptr)
thd->time_zone_used= 1;
temp= time_tmp.year % 100;
- if (temp < YY_PART_YEAR)
+ if (temp < YY_PART_YEAR - 1)
{
*to++= '2';
*to++= '0';