Commit 14e4f803 authored by Sergei Golubchik's avatar Sergei Golubchik

lp:737496 Assertion `(was_cut & 1) == 0' failed in...

lp:737496 Assertion `(was_cut & 1) == 0' failed in Field_temporal::store_TIME_with_warning() in 5.1-micro

fix incorrect assert
parent 47b201ab
......@@ -283,3 +283,8 @@ the_date the_time the_date the_time
DROP TABLE t1;
DROP VIEW v1;
End of 5.1 tests
create table t1 (f1 date, key (f1));
insert t1 values ('2010-10-10 15:foobar');
Warnings:
Warning 1265 Data truncated for column 'f1' at row 1
drop table t1;
......@@ -267,3 +267,11 @@ DROP TABLE t1;
DROP VIEW v1;
--echo End of 5.1 tests
#
# lp:737496 Field_temporal::store_TIME_with_warning() in 5.1-micro
#
create table t1 (f1 date, key (f1));
insert t1 values ('2010-10-10 15:foobar');
drop table t1;
......@@ -5189,15 +5189,16 @@ int Field_temporal::store_TIME_with_warning(MYSQL_TIME *ltime,
was_cut= MYSQL_TIME_WARN_TRUNCATED;
ret= 1;
}
else if (temporal_type() == MYSQL_TIMESTAMP_DATE &&
else if (!(was_cut & MYSQL_TIME_WARN_TRUNCATED) &&
temporal_type() == MYSQL_TIMESTAMP_DATE &&
(ltime->hour || ltime->minute || ltime->second || ltime->second_part))
{
DBUG_ASSERT((was_cut & MYSQL_TIME_WARN_TRUNCATED) == 0);
trunc_level= MYSQL_ERROR::WARN_LEVEL_NOTE;
was_cut|= MYSQL_TIME_WARN_TRUNCATED;
ret= 3;
}
else if (temporal_type() == MYSQL_TIMESTAMP_TIME &&
else if (!(was_cut & MYSQL_TIME_WARN_TRUNCATED) &&
temporal_type() == MYSQL_TIMESTAMP_TIME &&
(ltime->year || ltime->month))
{
ltime->year= ltime->month= ltime->day= 0;
......
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