Commit 1c5e7cbf authored by Igor Babaev's avatar Igor Babaev

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. 
parent 6e719145
...@@ -7849,3 +7849,36 @@ c1 c2 count(c3) ...@@ -7849,3 +7849,36 @@ c1 c2 count(c3)
2012-03-01 01:00:00 3 1 2012-03-01 01:00:00 3 1
2012-03-01 02:00:00 3 1 2012-03-01 02:00:00 3 1
DROP PROCEDURE p1; 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
...@@ -9145,3 +9145,44 @@ CALL p1(2); ...@@ -9145,3 +9145,44 @@ CALL p1(2);
CALL p1(1); CALL p1(1);
DROP PROCEDURE p1; 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
...@@ -1941,6 +1941,11 @@ class Item_func_sp :public Item_func ...@@ -1941,6 +1941,11 @@ class Item_func_sp :public Item_func
return str; return str;
} }
void update_null_value()
{
execute();
}
virtual bool change_context_processor(uchar *cntx) virtual bool change_context_processor(uchar *cntx)
{ context= (Name_resolution_context *)cntx; return FALSE; } { context= (Name_resolution_context *)cntx; return FALSE; }
...@@ -1955,6 +1960,7 @@ class Item_func_sp :public Item_func ...@@ -1955,6 +1960,7 @@ class Item_func_sp :public Item_func
{ {
return sp_result_field; return sp_result_field;
} }
bool check_vcol_func_processor(uchar *int_arg) bool check_vcol_func_processor(uchar *int_arg)
{ {
return trace_unsupported_by_check_vcol_func_processor(func_name()); return trace_unsupported_by_check_vcol_func_processor(func_name());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment