diff options
author | Igor Babaev <igor@askmonty.org> | 2012-06-15 00:01:20 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-06-15 00:01:20 -0700 |
commit | 1d74ae6b42296edb585d42439ca472632c57d06e (patch) | |
tree | 0a9b35a34f5af3cfecc982632656f30df59340c2 | |
parent | 28b4aba40a65006af33cc8e1464ab28643442309 (diff) | |
download | mariadb-git-1d74ae6b42296edb585d42439ca472632c57d06e.tar.gz |
Fixed LP bug #1002157.
The class Item_func missed an implementation of the virtual
function update_null_value.
Back-ported the fix for bug 62125 from mysql 5.6 code line.
The test case was also back-ported.
-rw-r--r-- | mysql-test/r/sp.result | 33 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 41 | ||||
-rw-r--r-- | sql/item_func.h | 6 |
3 files changed, 80 insertions, 0 deletions
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 05f9000bb33..414eeada0de 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -7849,3 +7849,36 @@ c1 c2 count(c3) 2012-03-01 01:00:00 3 1 2012-03-01 02:00:00 3 1 DROP PROCEDURE p1; +# +# LP bug#1002157 : testing stored function +# bug#62125 result for null incorrectly yields 1292 warning. +# +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +DROP FUNCTION IF EXISTS f3; +DROP FUNCTION IF EXISTS f4; +CREATE FUNCTION f1() RETURNS VARCHAR(1) +BEGIN RETURN 'X'; END;/ +CREATE FUNCTION f2() RETURNS CHAR(1) +BEGIN RETURN 'X'; END;/ +CREATE FUNCTION f3() RETURNS VARCHAR(1) +BEGIN RETURN NULL; END;/ +CREATE FUNCTION f4() RETURNS CHAR(1) +BEGIN RETURN NULL; END;/ +SELECT f1() IS NULL; +f1() IS NULL +0 +SELECT f2() IS NULL; +f2() IS NULL +0 +SELECT f3() IS NULL; +f3() IS NULL +1 +SELECT f4() IS NULL; +f4() IS NULL +1 +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP FUNCTION f3; +DROP FUNCTION f4; +# End of 5.5 test diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 5d92fea0bf1..08421040109 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9145,3 +9145,44 @@ CALL p1(2); CALL p1(1); DROP PROCEDURE p1; + +--echo # +--echo # LP bug#1002157 : testing stored function +--echo # bug#62125 result for null incorrectly yields 1292 warning. +--echo # + +--disable_warnings +DROP FUNCTION IF EXISTS f1; +DROP FUNCTION IF EXISTS f2; +DROP FUNCTION IF EXISTS f3; +DROP FUNCTION IF EXISTS f4; +--enable_warnings + +delimiter /; + +CREATE FUNCTION f1() RETURNS VARCHAR(1) +BEGIN RETURN 'X'; END;/ + +CREATE FUNCTION f2() RETURNS CHAR(1) +BEGIN RETURN 'X'; END;/ + +CREATE FUNCTION f3() RETURNS VARCHAR(1) +BEGIN RETURN NULL; END;/ + +CREATE FUNCTION f4() RETURNS CHAR(1) +BEGIN RETURN NULL; END;/ + +delimiter ;/ + +SELECT f1() IS NULL; +SELECT f2() IS NULL; +SELECT f3() IS NULL; +SELECT f4() IS NULL; + +DROP FUNCTION f1; +DROP FUNCTION f2; +DROP FUNCTION f3; +DROP FUNCTION f4; + +--echo # End of 5.5 test + diff --git a/sql/item_func.h b/sql/item_func.h index f91107c5445..cb9c1929d7d 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1941,6 +1941,11 @@ public: return str; } + void update_null_value() + { + execute(); + } + virtual bool change_context_processor(uchar *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } @@ -1955,6 +1960,7 @@ public: { return sp_result_field; } + bool check_vcol_func_processor(uchar *int_arg) { return trace_unsupported_by_check_vcol_func_processor(func_name()); |