Skip to content

Commit

Permalink
add a test for drop trigger under --read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Mar 7, 2015
1 parent 18feb62 commit 6d8b74d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mysql-test/r/read_only.result
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ connection default;
set global read_only=0;
connection con1;
create table t1 (a int);
create trigger trg1 before insert on t1 for each row set @a:=1;
insert into t1 values(1);
create table t2 select * from t1;
connection default;
Expand All @@ -20,6 +21,8 @@ create table t3 (a int);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
insert into t1 values(1);
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
drop trigger trg1;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
update t1 set a=1 where 1=0;
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/t/read_only.test
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set global read_only=0;
connection con1;

create table t1 (a int);
create trigger trg1 before insert on t1 for each row set @a:=1;

insert into t1 values(1);

Expand All @@ -56,6 +57,9 @@ create table t3 (a int);
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);

--error ER_OPTION_PREVENTS_STATEMENT
drop trigger trg1;

# if a statement, after parse stage, looks like it will update a
# non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated
Expand Down

0 comments on commit 6d8b74d

Please sign in to comment.