From 0536c506ff7c3ed261abc3d02fb787bfdd228abb Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 30 Aug 2012 09:05:27 +0200 Subject: [PATCH] MDEV-437 Microseconds: In time functions precision is calculated modulo 256 store the precision in uint, not uint8 --- mysql-test/r/func_time.result | 2 ++ mysql-test/t/func_time.test | 2 ++ sql/item.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index b3e2a01e2e3..2df0c691083 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -1897,3 +1897,5 @@ cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetime(6)) select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010'); microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010') 123456 10 +select now(258); +ERROR 42000: Too big precision 258 specified for 'now'. Maximum is 6. diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 07e6473bfdf..c3d1d74ec50 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1142,3 +1142,5 @@ select cast(greatest(cast("0-0-0" as date), cast("10:20:05" as time)) as datetim select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010'); +--error ER_TOO_BIG_PRECISION +select now(258); diff --git a/sql/item.h b/sql/item.h index ab5243a3d0a..055225a79d7 100644 --- a/sql/item.h +++ b/sql/item.h @@ -582,8 +582,8 @@ public: calls. */ uint name_length; /* Length of name */ + uint decimals; int8 marker; - uint8 decimals; bool maybe_null; /* If item may be null */ bool in_rollup; /* If used in GROUP BY list of a query with ROLLUP */