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
029cc52c
Commit
029cc52c
authored
Sep 07, 2010
by
Dmitry Shulga
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge from mysql-5.1-bugteam.
parents
5c5cd576
d6f6db6f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
0 deletions
+78
-0
mysql-test/r/trigger_notembedded.result
mysql-test/r/trigger_notembedded.result
+21
-0
mysql-test/t/trigger_notembedded.test
mysql-test/t/trigger_notembedded.test
+48
-0
sql/sql_trigger.cc
sql/sql_trigger.cc
+9
-0
No files found.
mysql-test/r/trigger_notembedded.result
View file @
029cc52c
...
...
@@ -472,4 +472,25 @@ SHOW CREATE TRIGGER db1.trg;
ERROR 42000: Access denied; you need (at least one of) the TRIGGER privilege(s) for this operation
DROP USER 'no_rights'@'localhost';
DROP DATABASE db1;
DROP DATABASE IF EXISTS mysqltest_db1;
CREATE DATABASE mysqltest_db1;
USE mysqltest_db1;
GRANT ALL ON mysqltest_db1.* TO mysqltest_u1@localhost;
CREATE TABLE t1 (
a1 int,
a2 int
);
INSERT INTO t1 VALUES (1, 20);
CREATE TRIGGER mysqltest_db1.upd_t1
BEFORE UPDATE ON t1 FOR EACH ROW SET new.a2 = 200;
CREATE TABLE t2 (
a1 int
);
INSERT INTO t2 VALUES (2);
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table 't1'
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
USE test;
End of 5.1 tests.
mysql-test/t/trigger_notembedded.test
View file @
029cc52c
...
...
@@ -932,4 +932,52 @@ disconnect con1;
DROP
USER
'no_rights'
@
'localhost'
;
DROP
DATABASE
db1
;
#
# Bug#55421 Protocol::end_statement(): Assertion `0' on multi-table UPDATE IGNORE
# To reproduce a crash we need to provoke a trigger execution with
# the following conditions:
# - active SELECT statement during trigger execution
# (i.e. LEX::current_select != NULL);
# - IGNORE option (i.e. LEX::current_select->no_error == TRUE);
--
disable_warnings
DROP
DATABASE
IF
EXISTS
mysqltest_db1
;
--
enable_warnings
CREATE
DATABASE
mysqltest_db1
;
USE
mysqltest_db1
;
GRANT
ALL
ON
mysqltest_db1
.*
TO
mysqltest_u1
@
localhost
;
--
connect
(
con1
,
localhost
,
mysqltest_u1
,,
mysqltest_db1
)
CREATE
TABLE
t1
(
a1
int
,
a2
int
);
INSERT
INTO
t1
VALUES
(
1
,
20
);
CREATE
TRIGGER
mysqltest_db1
.
upd_t1
BEFORE
UPDATE
ON
t1
FOR
EACH
ROW
SET
new
.
a2
=
200
;
CREATE
TABLE
t2
(
a1
int
);
INSERT
INTO
t2
VALUES
(
2
);
--
connection
default
REVOKE
ALL
PRIVILEGES
,
GRANT
OPTION
FROM
mysqltest_u1
@
localhost
;
--
error
ER_TABLEACCESS_DENIED_ERROR
UPDATE
IGNORE
t1
,
t2
SET
t1
.
a1
=
2
,
t2
.
a1
=
3
WHERE
t1
.
a1
=
1
AND
t2
.
a1
=
2
;
# Cleanup
DROP
DATABASE
mysqltest_db1
;
DROP
USER
mysqltest_u1
@
localhost
;
--
disconnect
con1
--
connection
default
USE
test
;
--
echo
End
of
5.1
tests
.
sql/sql_trigger.cc
View file @
029cc52c
...
...
@@ -2006,6 +2006,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
bool
err_status
;
Sub_statement_state
statement_state
;
sp_head
*
sp_trigger
=
bodies
[
event
][
time_type
];
SELECT_LEX
*
save_current_select
;
if
(
sp_trigger
==
NULL
)
return
FALSE
;
...
...
@@ -2029,11 +2030,19 @@ bool Table_triggers_list::process_triggers(THD *thd,
thd
->
reset_sub_statement_state
(
&
statement_state
,
SUB_STMT_TRIGGER
);
/*
Reset current_select before call execute_trigger() and
restore it after return from one. This way error is set
in case of failure during trigger execution.
*/
save_current_select
=
thd
->
lex
->
current_select
;
thd
->
lex
->
current_select
=
NULL
;
err_status
=
sp_trigger
->
execute_trigger
(
thd
,
&
trigger_table
->
s
->
db
,
&
trigger_table
->
s
->
table_name
,
&
subject_table_grants
[
event
][
time_type
]);
thd
->
lex
->
current_select
=
save_current_select
;
thd
->
restore_sub_statement_state
(
&
statement_state
);
...
...
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