Commit a169ede1 authored by Sergei Golubchik's avatar Sergei Golubchik

lp:736358 Unexpected increased timestamp resolution with UNION

partial fix
parent 3c6ff364
...@@ -149,3 +149,21 @@ select * from t1; ...@@ -149,3 +149,21 @@ select * from t1;
a a
2011-01-01 01:01:01.123456 2011-01-01 01:01:01.123456
drop table t1; drop table t1;
create table t1 (f1 timestamp(6));
insert into t1 values ('2002-07-15 21:00:00');
select time(f1) from t1;
time(f1)
21:00:00.000000
select time(f1) from t1 union all select time(f1) from t1;
time(f1)
21:00:00.000000
21:00:00.000000
alter table t1 modify f1 varchar(100);
select time(f1) from t1;
time(f1)
21:00:00
select time(f1) from t1 union all select time(f1) from t1;
time(f1)
21:00:00.000000
21:00:00.000000
drop table t1;
...@@ -78,3 +78,19 @@ insert t1 values (now(6)); ...@@ -78,3 +78,19 @@ insert t1 values (now(6));
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# lp:736358 Unexpected increased timestamp resolution with UNION
#
# timestamp(6) case is fixed:
create table t1 (f1 timestamp(6));
insert into t1 values ('2002-07-15 21:00:00');
select time(f1) from t1;
select time(f1) from t1 union all select time(f1) from t1;
#alter table t1 modify f1 timestamp;
#select time(f1) from t1;
#select time(f1) from t1 union all select time(f1) from t1;
# but the effect cannot be eliminated completely:
alter table t1 modify f1 varchar(100);
select time(f1) from t1;
select time(f1) from t1 union all select time(f1) from t1;
drop table t1;
...@@ -699,6 +699,8 @@ public: ...@@ -699,6 +699,8 @@ public:
collation.set(&my_charset_bin); collation.set(&my_charset_bin);
maybe_null= 1; maybe_null= 1;
max_length= MAX_TIME_WIDTH; max_length= MAX_TIME_WIDTH;
if (decimals == NOT_FIXED_DEC)
decimals= args[0]->decimals;
if (decimals && decimals != NOT_FIXED_DEC) if (decimals && decimals != NOT_FIXED_DEC)
max_length+= min(decimals, MAX_SEC_PART_DIGITS) + 1; max_length+= min(decimals, MAX_SEC_PART_DIGITS) + 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment