Commit e8041c70 authored by Igor Babaev's avatar Igor Babaev

MDEV-33270 Failure to call SP invoking another SP with parameter requiring type conversion

This patch corrects the fix for MDEV-32569. The latter has not taken into
account the fact not each statement uses the SELECT_LEX structure. In
particular CALL statements do not use such structure. However the parameter
passed to the stored procedure used in such a statement may require an
invocation of Type_std_attributes::agg_item_set_converter().

Approved by Oleksandr Byelkin <sanja@mariadb.com>
parent 2ef01d00
......@@ -8960,5 +8960,20 @@ DROP FUNCTION f1;
DROP FUNCTION f2;
DROP FUNCTION f3;
DROP VIEW v1;
#
# MDEV-33270: Call of SP invoking another SP with a parameter
# requiring type conversion
#
SET NAMES latin1;
CREATE PROCEDURE p1 (a text) BEGIN SELECT a; END |
CREATE PROCEDURE p2 () CALL p1(concat('x',_utf8'x')) |
CALL p2();
a
xx
CALL p2();
a
xx
DROP PROCEDURE p1;
DROP PROCEDURE p2;
# End of 10.4 tests
#
......@@ -10567,5 +10567,25 @@ DROP FUNCTION f2;
DROP FUNCTION f3;
DROP VIEW v1;
--echo #
--echo # MDEV-33270: Call of SP invoking another SP with a parameter
--echo # requiring type conversion
--echo #
SET NAMES latin1;
--delimiter |
CREATE PROCEDURE p1 (a text) BEGIN SELECT a; END |
CREATE PROCEDURE p2 () CALL p1(concat('x',_utf8'x')) |
--delimiter ;
CALL p2();
CALL p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
--echo # End of 10.4 tests
--echo #
......@@ -2586,7 +2586,10 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
return TRUE;
if (!thd->stmt_arena->is_conventional() &&
thd->lex->current_select->first_cond_optimization)
((!thd->lex->current_select &&
(thd->stmt_arena->is_stmt_prepare_or_first_sp_execute() ||
thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute())) ||
thd->lex->current_select->first_cond_optimization))
{
Query_arena *arena, backup;
arena= thd->activate_stmt_arena_if_needed(&backup);
......
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