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
444eabca
Commit
444eabca
authored
Nov 11, 2010
by
Dmitry Shulga
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge from mysql-5.1-bugteam for bug#54375.
parents
2e2f3b1f
871f3635
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
1 deletion
+74
-1
mysql-test/r/sp-bugs.result
mysql-test/r/sp-bugs.result
+36
-0
mysql-test/t/sp-bugs.test
mysql-test/t/sp-bugs.test
+37
-0
sql/sp_head.cc
sql/sp_head.cc
+1
-1
No files found.
mysql-test/r/sp-bugs.result
View file @
444eabca
...
...
@@ -75,4 +75,40 @@ CALL p1 ();
ERROR HY000: Trigger does not exist
DROP TABLE t1;
DROP PROCEDURE p1;
#
# Bug#54375: Error in stored procedure leaves connection
# in different default schema
#
SET @@SQL_MODE = 'STRICT_ALL_TABLES';
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
USE db1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY);
INSERT INTO t1 VALUES (1);
CREATE FUNCTION f1 (
some_value int
)
RETURNS smallint
DETERMINISTIC
BEGIN
INSERT INTO t1 SET c1 = some_value;
RETURN(LAST_INSERT_ID());
END$$
DROP DATABASE IF EXISTS db2;
CREATE DATABASE db2;
USE db2;
SELECT DATABASE();
DATABASE()
db2
SELECT db1.f1(1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SELECT DATABASE();
DATABASE()
db2
USE test;
DROP FUNCTION db1.f1;
DROP TABLE db1.t1;
DROP DATABASE db1;
DROP DATABASE db2;
End of 5.1 tests
mysql-test/t/sp-bugs.test
View file @
444eabca
...
...
@@ -101,4 +101,41 @@ CALL p1 ();
DROP
TABLE
t1
;
DROP
PROCEDURE
p1
;
--
echo
#
--
echo
# Bug#54375: Error in stored procedure leaves connection
--
echo
# in different default schema
--
echo
#
--
disable_warnings
SET
@@
SQL_MODE
=
'STRICT_ALL_TABLES'
;
DROP
DATABASE
IF
EXISTS
db1
;
CREATE
DATABASE
db1
;
USE
db1
;
DROP
TABLE
IF
EXISTS
t1
;
CREATE
TABLE
t1
(
c1
int
NOT
NULL
PRIMARY
KEY
);
INSERT
INTO
t1
VALUES
(
1
);
DELIMITER
$$
;
CREATE
FUNCTION
f1
(
some_value
int
)
RETURNS
smallint
DETERMINISTIC
BEGIN
INSERT
INTO
t1
SET
c1
=
some_value
;
RETURN
(
LAST_INSERT_ID
());
END
$$
DELIMITER
;
$$
DROP
DATABASE
IF
EXISTS
db2
;
CREATE
DATABASE
db2
;
--
enable_warnings
USE
db2
;
SELECT
DATABASE
();
--
error
ER_DUP_ENTRY
SELECT
db1
.
f1
(
1
);
SELECT
DATABASE
();
USE
test
;
DROP
FUNCTION
db1
.
f1
;
DROP
TABLE
db1
.
t1
;
DROP
DATABASE
db1
;
DROP
DATABASE
db2
;
--
echo
End
of
5.1
tests
sql/sp_head.cc
View file @
444eabca
...
...
@@ -1510,7 +1510,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success)
If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed
*/
if
(
cur_db_changed
&&
!
thd
->
killed
)
if
(
cur_db_changed
&&
thd
->
killed
!=
THD
::
KILL_CONNECTION
)
{
/*
Force switching back to the saved current database, because it may be
...
...
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