1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

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>
This commit is contained in:
Igor Babaev
2024-01-18 20:59:00 -08:00
parent 2ef01d0034
commit e8041c7065
3 changed files with 39 additions and 1 deletions

View File

@@ -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
#

View File

@@ -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 #

View File

@@ -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);