mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Post-review fixes of the patch for BUG#8408: Stored procedure crash if function contains SHOW
(Review on irc by monty)
This commit is contained in:
parent
79cf164767
commit
f769a7a8b0
5 changed files with 28 additions and 29 deletions
|
@ -594,8 +594,6 @@ alter function bug7047;
|
|||
return 0;
|
||||
end|
|
||||
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
|
||||
drop function if exists bug8408|
|
||||
drop procedure if exists bug8408|
|
||||
create function bug8408() returns int
|
||||
begin
|
||||
select * from t1;
|
||||
|
@ -615,19 +613,21 @@ select b;
|
|||
return b;
|
||||
end|
|
||||
ERROR 0A000: Not allowed to return a result set from a function
|
||||
create function bug8408() returns int
|
||||
drop function if exists bug8408_f|
|
||||
drop procedure if exists bug8408_p|
|
||||
create function bug8408_f() returns int
|
||||
begin
|
||||
call bug8408();
|
||||
call bug8408_p();
|
||||
return 0;
|
||||
end|
|
||||
create procedure bug8408()
|
||||
create procedure bug8408_p()
|
||||
select * from t1|
|
||||
call bug8408()|
|
||||
call bug8408_p()|
|
||||
val x
|
||||
select bug8408()|
|
||||
ERROR 0A000: SELECT in a stored procedure must have INTO
|
||||
drop procedure bug8408|
|
||||
drop function bug8408|
|
||||
select bug8408_f()|
|
||||
ERROR 0A000: PROCEDURE test.bug8408_p can't return a result set in the given context
|
||||
drop procedure bug8408_p|
|
||||
drop function bug8408_f|
|
||||
create function bug8408() returns int
|
||||
begin
|
||||
declare n int default 0;
|
||||
|
|
|
@ -835,10 +835,6 @@ end|
|
|||
# BUG#8408: Stored procedure crash if function contains SHOW
|
||||
# BUG#9058: Stored Procedures: Crash if function included SELECT
|
||||
#
|
||||
--disable_warnings
|
||||
drop function if exists bug8408|
|
||||
drop procedure if exists bug8408|
|
||||
--enable_warnings
|
||||
|
||||
# Some things are caught when parsing
|
||||
--error ER_SP_NO_RETSET_IN_FUNC
|
||||
|
@ -861,21 +857,26 @@ begin
|
|||
return b;
|
||||
end|
|
||||
|
||||
--disable_warnings
|
||||
drop function if exists bug8408_f|
|
||||
drop procedure if exists bug8408_p|
|
||||
--enable_warnings
|
||||
|
||||
# Some things must be caught at invokation time
|
||||
create function bug8408() returns int
|
||||
create function bug8408_f() returns int
|
||||
begin
|
||||
call bug8408();
|
||||
call bug8408_p();
|
||||
return 0;
|
||||
end|
|
||||
create procedure bug8408()
|
||||
create procedure bug8408_p()
|
||||
select * from t1|
|
||||
|
||||
call bug8408()|
|
||||
call bug8408_p()|
|
||||
--error ER_SP_BADSELECT
|
||||
select bug8408()|
|
||||
select bug8408_f()|
|
||||
|
||||
drop procedure bug8408|
|
||||
drop function bug8408|
|
||||
drop procedure bug8408_p|
|
||||
drop function bug8408_f|
|
||||
|
||||
# But this is ok
|
||||
create function bug8408() returns int
|
||||
|
|
|
@ -4554,7 +4554,7 @@ Item_func_sp::execute(Item **itp)
|
|||
{
|
||||
DBUG_ENTER("Item_func_sp::execute");
|
||||
THD *thd= current_thd;
|
||||
bool clcap_mr;
|
||||
ulong old_client_capabilites;
|
||||
int res;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
st_sp_security_context save_ctx;
|
||||
|
@ -4568,7 +4568,7 @@ Item_func_sp::execute(Item **itp)
|
|||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
clcap_mr= (thd->client_capabilities & CLIENT_MULTI_RESULTS);
|
||||
old_client_capabilites= thd->client_capabilities;
|
||||
thd->client_capabilities &= ~CLIENT_MULTI_RESULTS;
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
|
@ -4586,8 +4586,7 @@ Item_func_sp::execute(Item **itp)
|
|||
m_sp->m_db.str, m_sp->m_name.str, 0))
|
||||
{
|
||||
sp_restore_security_context(thd, m_sp, &save_ctx);
|
||||
if (clcap_mr)
|
||||
thd->client_capabilities |= CLIENT_MULTI_RESULTS;
|
||||
thd->client_capabilities|= old_client_capabilites & CLIENT_MULTI_RESULTS;
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
#endif
|
||||
|
@ -4602,8 +4601,7 @@ Item_func_sp::execute(Item **itp)
|
|||
thd->net.no_send_ok= nsok;
|
||||
#endif
|
||||
|
||||
if (clcap_mr)
|
||||
thd->client_capabilities |= CLIENT_MULTI_RESULTS;
|
||||
thd->client_capabilities|= old_client_capabilites & CLIENT_MULTI_RESULTS;
|
||||
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
|
|
@ -5090,7 +5090,7 @@ ER_SP_LABEL_MISMATCH 42000
|
|||
ER_SP_UNINIT_VAR 01000
|
||||
eng "Referring to uninitialized variable %s"
|
||||
ER_SP_BADSELECT 0A000
|
||||
eng "SELECT in a stored procedure must have INTO"
|
||||
eng "PROCEDURE %s can't return a result set in the given context"
|
||||
ER_SP_BADRETURN 42000
|
||||
eng "RETURN is only allowed in a FUNCTION"
|
||||
ER_SP_BADSTATEMENT 0A000
|
||||
|
|
|
@ -4052,7 +4052,7 @@ unsent_create_error:
|
|||
{
|
||||
if (! (thd->client_capabilities & CLIENT_MULTI_RESULTS))
|
||||
{
|
||||
my_message(ER_SP_BADSELECT, ER(ER_SP_BADSELECT), MYF(0));
|
||||
my_error(ER_SP_BADSELECT, MYF(0), sp->m_qname.str);
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
thd->net.no_send_ok= nsok;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue