diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2017-05-22 07:09:49 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2017-05-22 07:09:49 +0200 |
commit | 46a1ae7283364741e926b50bbd5cc7a8019a8db1 (patch) | |
tree | bf660e9f7427f1da13ba8851eef0d3ccf50b2716 /mysql-test/t/sp.test | |
parent | 7d57ba6e28f8dd5f6ab48b0b99d110c2363b576d (diff) | |
download | mariadb-git-bb-5.5-MDEV-11958.tar.gz |
MDEV-11958: LEFT JOIN with stored routine produce incorrect resultbb-5.5-MDEV-11958
Added forgoten method of Item_func_sp to make it correctly work with LEFT/RIGHT JOIN.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r-- | mysql-test/t/sp.test | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 0e42bf3c831..dfe9d752739 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9353,4 +9353,33 @@ where 1=1; drop function if exists f1; drop table t1,t2; +--echo # +--echo # MDEV-11958: LEFT JOIN with stored routine produce incorrect result +--echo # + +CREATE TABLE t (x INT); +INSERT INTO t VALUES(1),(NULL); +CREATE FUNCTION f (val INT, ret INT) RETURNS INT DETERMINISTIC RETURN IFNULL(val, ret); + +SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) + FROM t t1 LEFT JOIN t t2 + ON t1.x = t2.x + WHERE IFNULL(t2.x,0)=0; +explain extended +SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) + FROM t t1 LEFT JOIN t t2 + ON t1.x = t2.x + WHERE IFNULL(t2.x,0)=0; +SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) + FROM t t1 LEFT JOIN t t2 + ON t1.x = t2.x + WHERE f(t2.x,0)=0; +explain extended +SELECT t1.x, t2.x, IFNULL(t2.x,0), f(t2.x,0) + FROM t t1 LEFT JOIN t t2 + ON t1.x = t2.x + WHERE f(t2.x,0)=0; + +drop function f; +drop table t; --echo # End of 5.5 test |