mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix for BUG#1547: "SELECT ... WHERE field = var" sometimes give the wrong result in SPs
Two missing methods added to Item_splocal + test case. mysql-test/r/sp.result: Test case for BUG#1547 mysql-test/t/sp.test: Test case for BUG#1547 sql/item.h: Fix for BUG#1547: "SELECT ... WHERE field = var" sometimes give the wrong result in SPs Added missing methods to Item_splocal to get the correct compare function and make the optimizer do the right thing.
This commit is contained in:
@ -601,6 +601,27 @@ less 2
|
||||
more 17
|
||||
delete from t1;
|
||||
drop procedure bug1495;
|
||||
create procedure bug1547(s char(16))
|
||||
begin
|
||||
declare x int;
|
||||
select data into x from t1 where s = id limit 1;
|
||||
if x > 10 then
|
||||
insert into t1 values ("less", x-10);
|
||||
else
|
||||
insert into t1 values ("more", x+10);
|
||||
end if;
|
||||
end;
|
||||
insert into t1 values ("foo", 12), ("bar", 7);
|
||||
call bug1547("foo");
|
||||
call bug1547("bar");
|
||||
select * from t1;
|
||||
id data
|
||||
foo 12
|
||||
bar 7
|
||||
less 2
|
||||
more 17
|
||||
delete from t1;
|
||||
drop procedure bug1547;
|
||||
drop table if exists fac;
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned);
|
||||
create procedure ifac(n int unsigned)
|
||||
|
@ -697,6 +697,28 @@ select * from t1|
|
||||
delete from t1|
|
||||
drop procedure bug1495|
|
||||
|
||||
#
|
||||
# BUG#1547
|
||||
#
|
||||
create procedure bug1547(s char(16))
|
||||
begin
|
||||
declare x int;
|
||||
|
||||
select data into x from t1 where s = id limit 1;
|
||||
if x > 10 then
|
||||
insert into t1 values ("less", x-10);
|
||||
else
|
||||
insert into t1 values ("more", x+10);
|
||||
end if;
|
||||
end|
|
||||
|
||||
insert into t1 values ("foo", 12), ("bar", 7)|
|
||||
call bug1547("foo")|
|
||||
call bug1547("bar")|
|
||||
select * from t1|
|
||||
delete from t1|
|
||||
drop procedure bug1547|
|
||||
|
||||
|
||||
#
|
||||
# Some "real" examples
|
||||
|
Reference in New Issue
Block a user