summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@sun.com>2010-03-09 15:54:12 +0100
committerTor Didriksen <tor.didriksen@sun.com>2010-03-09 15:54:12 +0100
commit58559ac827663a2b27bde116dc07610412330f06 (patch)
tree3a98514c79a71ffb0ef339f3b49ebb125682d529 /mysql-test
parent4315b101f5a3daf8841c0cc2fd64ce6bc033f981 (diff)
downloadmariadb-git-58559ac827663a2b27bde116dc07610412330f06.tar.gz
Bug#50888 valgrind warnings in Field_timestamp::val_str
Ensure that we store the correct cached_field_type whenever we cache Field items (in this case it allows us to compare dates as dates, rather than strings) mysql-test/r/type_timestamp.result: Add test case. mysql-test/t/type_timestamp.test: Add test case. sql/item.h: Initialize cached_field_type from the Field item.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/type_timestamp.result16
-rw-r--r--mysql-test/t/type_timestamp.test14
2 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index fd13f53d02b..672b4d423a3 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -503,3 +503,19 @@ f1 f2-f3
5 0
DROP TABLE t1;
End of 5.0 tests
+
+Bug#50888 valgrind warnings in Field_timestamp::val_str
+
+SET TIMESTAMP=0;
+CREATE TABLE t1(a timestamp);
+INSERT INTO t1 VALUES ('2008-02-23 09:23:45'), ('2010-03-05 11:08:02');
+FLUSH TABLES t1;
+SELECT MAX(a) FROM t1;
+MAX(a)
+2010-03-05 11:08:02
+SELECT a FROM t1;
+a
+2008-02-23 09:23:45
+2010-03-05 11:08:02
+DROP TABLE t1;
+End of Bug#50888
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 2a49e0def1a..5c3a759b589 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -346,3 +346,17 @@ SELECT f1,f2-f3 FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests
+
+--echo
+--echo Bug#50888 valgrind warnings in Field_timestamp::val_str
+--echo
+
+SET TIMESTAMP=0;
+CREATE TABLE t1(a timestamp);
+INSERT INTO t1 VALUES ('2008-02-23 09:23:45'), ('2010-03-05 11:08:02');
+FLUSH TABLES t1;
+SELECT MAX(a) FROM t1;
+SELECT a FROM t1;
+DROP TABLE t1;
+
+--echo End of Bug#50888