From 58559ac827663a2b27bde116dc07610412330f06 Mon Sep 17 00:00:00 2001 From: Tor Didriksen Date: Tue, 9 Mar 2010 15:54:12 +0100 Subject: 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. --- mysql-test/r/type_timestamp.result | 16 ++++++++++++++++ mysql-test/t/type_timestamp.test | 14 ++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'mysql-test') 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 -- cgit v1.2.1