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
bee76b78
Commit
bee76b78
authored
Oct 19, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and a test case for Bug#13587 "Server crash when SP is created
without database"
parent
867e790d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
7 deletions
+58
-7
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+11
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+18
-0
sql/sql_parse.cc
sql/sql_parse.cc
+29
-7
No files found.
mysql-test/r/sp-error.result
View file @
bee76b78
...
...
@@ -872,3 +872,14 @@ names
foo4
drop procedure bug13510_3|
drop procedure bug13510_4|
create database mysqltest1;
use mysqltest1;
drop database mysqltest1;
create function f1() returns int return 1;
ERROR 3D000: No database selected
create procedure p1(out param1 int)
begin
select count(*) into param1 from t3;
end|
ERROR 3D000: No database selected
use test;
mysql-test/t/sp-error.test
View file @
bee76b78
...
...
@@ -1266,6 +1266,24 @@ drop procedure bug13510_4|
delimiter
;
|
#
# Bug#13514 "server crash when create a stored procedure before choose a
# database" and
# Bug#13587 "Server crash when SP is created without database
# selected"
#
create
database
mysqltest1
;
use
mysqltest1
;
drop
database
mysqltest1
;
--
error
ER_NO_DB_ERROR
create
function
f1
()
returns
int
return
1
;
delimiter
|
;
--
error
ER_NO_DB_ERROR
create
procedure
p1
(
out
param1
int
)
begin
select
count
(
*
)
into
param1
from
t3
;
end
|
delimiter
;
|
use
test
;
# BUG#NNNN: New bug synopsis
#
#--disable_warnings
...
...
sql/sql_parse.cc
View file @
bee76b78
...
...
@@ -4068,6 +4068,19 @@ end_with_restore_list:
DBUG_ASSERT
(
lex
->
sphead
!=
0
);
if
(
!
lex
->
sphead
->
m_db
.
str
||
!
lex
->
sphead
->
m_db
.
str
[
0
])
{
if
(
!
thd
->
db
)
{
my_message
(
ER_NO_DB_ERROR
,
ER
(
ER_NO_DB_ERROR
),
MYF
(
0
));
delete
lex
->
sphead
;
lex
->
sphead
=
0
;
goto
error
;
}
lex
->
sphead
->
m_db
.
length
=
strlen
(
thd
->
db
);
lex
->
sphead
->
m_db
.
str
=
thd
->
db
;
}
if
(
check_access
(
thd
,
CREATE_PROC_ACL
,
lex
->
sphead
->
m_db
.
str
,
0
,
0
,
0
,
is_schema_db
(
lex
->
sphead
->
m_db
.
str
)))
{
...
...
@@ -4077,13 +4090,10 @@ end_with_restore_list:
}
if
(
end_active_trans
(
thd
))
goto
error
;
if
(
!
lex
->
sphead
->
m_db
.
str
||
!
lex
->
sphead
->
m_db
.
str
[
0
])
{
lex
->
sphead
->
m_db
.
length
=
strlen
(
thd
->
db
)
;
lex
->
sphead
->
m_db
.
str
=
strmake_root
(
thd
->
mem_root
,
thd
->
db
,
lex
->
sphead
->
m_db
.
length
)
;
delete
lex
->
sphead
;
lex
->
sphead
=
0
;
goto
error
;
}
name
=
lex
->
sphead
->
name
(
&
namelen
);
...
...
@@ -4110,11 +4120,23 @@ end_with_restore_list:
goto
error
;
}
/*
We need to copy name and db in order to use them for
check_routine_access which is called after lex->sphead has
been deleted.
*/
name
=
thd
->
strdup
(
name
);
db
=
thd
->
strmake
(
lex
->
sphead
->
m_db
.
str
,
lex
->
sphead
->
m_db
.
length
);
lex
->
sphead
->
m_db
.
str
=
db
=
thd
->
strmake
(
lex
->
sphead
->
m_db
.
str
,
lex
->
sphead
->
m_db
.
length
);
res
=
(
result
=
lex
->
sphead
->
create
(
thd
));
if
(
result
==
SP_OK
)
{
/*
We must cleanup the unit and the lex here because
sp_grant_privileges calls (indirectly) db_find_routine,
which in turn may call yyparse with THD::lex.
TODO: fix db_find_routine to use a temporary lex.
*/
lex
->
unit
.
cleanup
();
delete
lex
->
sphead
;
lex
->
sphead
=
0
;
...
...
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