mirror of
https://github.com/MariaDB/server.git
synced 2026-05-02 13:15:32 +02:00
Fix bug#14186 select datefield is null not updated
Date field was declared as not null, thus expression 'datefield is null' was always false. For SELECT special handling of such cases is used. There 'datefield is null' converted to 'datefield eq "0000-00-00"'. In mysql_update() before creation of select added remove_eq_conds() call. It makes some optimization of conds and in particular performs conversion from 'is null' to 'eq'. Also remove_eq_conds() makes some evaluation of conds and if it founds that conds is always false then update statement is not processed further. All this allows to perform some update statements process faster due to optimized conds, and not wasting resources if conds known to be false. sql/sql_select.cc: Fix bug#14186 select datefield is null not updated Remove static from remove_eq_conds() sql/sql_select.h: Fix bug#14186 select datefield is null not updated Added remove_eq_conds() prototype. mysql-test/r/update.result: Test case for bug#14186 select datefield is null not updated mysql-test/t/update.test: Test case for bug#14186 select datefield is null not updated sql/sql_update.cc: Fix bug#14186 select datefield is null not updated To mysql_update() added call to remove_eq_conds() to optimize conds and convert 'datefield is null' to 'datefield eq 0000-00-00'
This commit is contained in:
parent
fe90e5677c
commit
6020281e95
5 changed files with 31 additions and 7 deletions
|
|
@ -260,5 +260,14 @@ update t1 set a=a+11,b=2 order by a limit 3;
|
|||
update t1 set a=a+12,b=3 order by a limit 3;
|
||||
select * from t1 order by a;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#14186 select datefield is null not updated
|
||||
#
|
||||
create table t1 (f1 date not null);
|
||||
insert into t1 values('2000-01-01'),('0000-00-00');
|
||||
update t1 set f1='2002-02-02' where f1 is null;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
# End of 4.1 tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue