Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f769a7a8
Commit
f769a7a8
authored
Apr 27, 2005
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Post-review fixes of the patch for BUG#8408: Stored procedure crash if function contains SHOW
(Review on irc by monty)
parent
79cf1647
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
29 deletions
+28
-29
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+10
-10
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+12
-11
sql/item_func.cc
sql/item_func.cc
+4
-6
sql/share/errmsg.txt
sql/share/errmsg.txt
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
No files found.
mysql-test/r/sp-error.result
View file @
f769a7a8
...
@@ -594,8 +594,6 @@ alter function bug7047;
...
@@ -594,8 +594,6 @@ alter function bug7047;
return 0;
return 0;
end|
end|
ERROR HY000: Can't drop or alter a FUNCTION from within another stored routine
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
create function bug8408() returns int
begin
begin
select * from t1;
select * from t1;
...
@@ -615,19 +613,21 @@ select b;
...
@@ -615,19 +613,21 @@ select b;
return b;
return b;
end|
end|
ERROR 0A000: Not allowed to return a result set from a function
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
begin
call bug8408();
call bug8408
_p
();
return 0;
return 0;
end|
end|
create procedure bug8408()
create procedure bug8408
_p
()
select * from t1|
select * from t1|
call bug8408()|
call bug8408
_p
()|
val x
val x
select bug8408()|
select bug8408
_f
()|
ERROR 0A000:
SELECT in a stored procedure must have INTO
ERROR 0A000:
PROCEDURE test.bug8408_p can't return a result set in the given context
drop procedure bug8408|
drop procedure bug8408
_p
|
drop function bug8408|
drop function bug8408
_f
|
create function bug8408() returns int
create function bug8408() returns int
begin
begin
declare n int default 0;
declare n int default 0;
...
...
mysql-test/t/sp-error.test
View file @
f769a7a8
...
@@ -835,10 +835,6 @@ end|
...
@@ -835,10 +835,6 @@ end|
# BUG#8408: Stored procedure crash if function contains SHOW
# BUG#8408: Stored procedure crash if function contains SHOW
# BUG#9058: Stored Procedures: Crash if function included SELECT
# 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
# Some things are caught when parsing
--
error
ER_SP_NO_RETSET_IN_FUNC
--
error
ER_SP_NO_RETSET_IN_FUNC
...
@@ -861,21 +857,26 @@ begin
...
@@ -861,21 +857,26 @@ begin
return
b
;
return
b
;
end
|
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
# Some things must be caught at invokation time
create
function
bug8408
()
returns
int
create
function
bug8408
_f
()
returns
int
begin
begin
call
bug8408
();
call
bug8408
_p
();
return
0
;
return
0
;
end
|
end
|
create
procedure
bug8408
()
create
procedure
bug8408
_p
()
select
*
from
t1
|
select
*
from
t1
|
call
bug8408
()
|
call
bug8408
_p
()
|
--
error
ER_SP_BADSELECT
--
error
ER_SP_BADSELECT
select
bug8408
()
|
select
bug8408
_f
()
|
drop
procedure
bug8408
|
drop
procedure
bug8408
_p
|
drop
function
bug8408
|
drop
function
bug8408
_f
|
# But this is ok
# But this is ok
create
function
bug8408
()
returns
int
create
function
bug8408
()
returns
int
...
...
sql/item_func.cc
View file @
f769a7a8
...
@@ -4554,7 +4554,7 @@ Item_func_sp::execute(Item **itp)
...
@@ -4554,7 +4554,7 @@ Item_func_sp::execute(Item **itp)
{
{
DBUG_ENTER
(
"Item_func_sp::execute"
);
DBUG_ENTER
(
"Item_func_sp::execute"
);
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
bool
clcap_mr
;
ulong
old_client_capabilites
;
int
res
;
int
res
;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
#ifndef NO_EMBEDDED_ACCESS_CHECKS
st_sp_security_context
save_ctx
;
st_sp_security_context
save_ctx
;
...
@@ -4568,7 +4568,7 @@ Item_func_sp::execute(Item **itp)
...
@@ -4568,7 +4568,7 @@ Item_func_sp::execute(Item **itp)
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
clcap_mr
=
(
thd
->
client_capabilities
&
CLIENT_MULTI_RESULTS
)
;
old_client_capabilites
=
thd
->
client_capabilities
;
thd
->
client_capabilities
&=
~
CLIENT_MULTI_RESULTS
;
thd
->
client_capabilities
&=
~
CLIENT_MULTI_RESULTS
;
#ifndef EMBEDDED_LIBRARY
#ifndef EMBEDDED_LIBRARY
...
@@ -4586,8 +4586,7 @@ Item_func_sp::execute(Item **itp)
...
@@ -4586,8 +4586,7 @@ Item_func_sp::execute(Item **itp)
m_sp
->
m_db
.
str
,
m_sp
->
m_name
.
str
,
0
))
m_sp
->
m_db
.
str
,
m_sp
->
m_name
.
str
,
0
))
{
{
sp_restore_security_context
(
thd
,
m_sp
,
&
save_ctx
);
sp_restore_security_context
(
thd
,
m_sp
,
&
save_ctx
);
if
(
clcap_mr
)
thd
->
client_capabilities
|=
old_client_capabilites
&
CLIENT_MULTI_RESULTS
;
thd
->
client_capabilities
|=
CLIENT_MULTI_RESULTS
;
DBUG_RETURN
(
-
1
);
DBUG_RETURN
(
-
1
);
}
}
#endif
#endif
...
@@ -4602,8 +4601,7 @@ Item_func_sp::execute(Item **itp)
...
@@ -4602,8 +4601,7 @@ Item_func_sp::execute(Item **itp)
thd
->
net
.
no_send_ok
=
nsok
;
thd
->
net
.
no_send_ok
=
nsok
;
#endif
#endif
if
(
clcap_mr
)
thd
->
client_capabilities
|=
old_client_capabilites
&
CLIENT_MULTI_RESULTS
;
thd
->
client_capabilities
|=
CLIENT_MULTI_RESULTS
;
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
...
...
sql/share/errmsg.txt
View file @
f769a7a8
...
@@ -5090,7 +5090,7 @@ ER_SP_LABEL_MISMATCH 42000
...
@@ -5090,7 +5090,7 @@ ER_SP_LABEL_MISMATCH 42000
ER_SP_UNINIT_VAR 01000
ER_SP_UNINIT_VAR 01000
eng "Referring to uninitialized variable %s"
eng "Referring to uninitialized variable %s"
ER_SP_BADSELECT 0A000
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
ER_SP_BADRETURN 42000
eng "RETURN is only allowed in a FUNCTION"
eng "RETURN is only allowed in a FUNCTION"
ER_SP_BADSTATEMENT 0A000
ER_SP_BADSTATEMENT 0A000
...
...
sql/sql_parse.cc
View file @
f769a7a8
...
@@ -4052,7 +4052,7 @@ unsent_create_error:
...
@@ -4052,7 +4052,7 @@ unsent_create_error:
{
{
if
(
!
(
thd
->
client_capabilities
&
CLIENT_MULTI_RESULTS
))
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
#ifndef EMBEDDED_LIBRARY
thd
->
net
.
no_send_ok
=
nsok
;
thd
->
net
.
no_send_ok
=
nsok
;
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment