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

fix incorrect assert
This commit is contained in:
Sergei Golubchik 2011-03-18 19:45:00 +01:00
parent c629477981
commit e79a72a410
3 changed files with 17 additions and 3 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;