mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fix for bug #22824: strict, datetime, NULL, wrong warning
During optimization we replace NULL with 0 for not null date{time} fields, so uset MODE_NO_ZERO_DATE flag for a while as we don't want to give extra warnings.
This commit is contained in:

parent
6a304f3fc1
commit
d779739834
@ -1352,3 +1352,10 @@ t1 CREATE TABLE `t1` (
|
|||||||
`i` int(11) default NULL
|
`i` int(11) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
set @@sql_mode='NO_ZERO_DATE';
|
||||||
|
create table t1(a datetime not null);
|
||||||
|
select count(*) from t1 where a is null;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
drop table t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@ -1208,3 +1208,14 @@ create table t1 (i int)
|
|||||||
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
|
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
|
||||||
show create table t1;
|
show create table t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #22824: strict, datetime, NULL, wrong warning
|
||||||
|
#
|
||||||
|
|
||||||
|
set @@sql_mode='NO_ZERO_DATE';
|
||||||
|
create table t1(a datetime not null);
|
||||||
|
select count(*) from t1 where a is null;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
@ -241,7 +241,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
|
|||||||
{
|
{
|
||||||
/* For comparison purposes allow invalid dates like 2000-01-32 */
|
/* For comparison purposes allow invalid dates like 2000-01-32 */
|
||||||
ulong orig_sql_mode= thd->variables.sql_mode;
|
ulong orig_sql_mode= thd->variables.sql_mode;
|
||||||
thd->variables.sql_mode|= MODE_INVALID_DATES;
|
thd->variables.sql_mode= (orig_sql_mode & ~MODE_NO_ZERO_DATE) |
|
||||||
|
MODE_INVALID_DATES;
|
||||||
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
|
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
|
||||||
{
|
{
|
||||||
Item *tmp=new Item_int_with_ref(field->val_int(), *item,
|
Item *tmp=new Item_int_with_ref(field->val_int(), *item,
|
||||||
|
Reference in New Issue
Block a user