mariadb/mysql-test/r/read_only.result
unknown 2b720487f0 Fix for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
Do not issue a 'read-only' error in case of DROP TEMPORARY TABLE on a non-existing temporary table.
Instead produce the correct "Unknown table" error or warning (in cases when the IF EXISTS clause was specified).

To a documentor: the part of the manual describing the 'read_only' system variable should be clarified to state the following:
"When the read_only variable is set to ON, all operations which create/update/drop tables are rejected with the exceptions for:
1. Any operation performed by the replication thread on a slave server
2. Any operation performed by a user that have the SUPER privilege
3. Any operation that creates/updates/drops only temporary tables"


mysql-test/r/read_only.result:
  Added testcases for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
mysql-test/t/read_only.test:
  Added testcases for bug #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
sql/sql_parse.cc:
  Before issuing the 'read-only' error also check if the operation is not a DROP TEMPORARY TABLE statement
2006-11-20 17:35:23 +03:00

49 lines
2 KiB
Text

DROP TABLE IF EXISTS t1,t2,t3;
grant CREATE, SELECT, DROP on *.* to test@localhost;
set global read_only=0;
create table t1 (a int);
insert into t1 values(1);
create table t2 select * from t1;
set global read_only=1;
create table t3 (a int);
drop table t3;
select @@global.read_only;
@@global.read_only
1
create table t3 (a int);
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
insert into t1 values(1);
ERROR HY000: The MySQL 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 MySQL 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;
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
delete t1,t2 from t1,t2 where t1.a=t2.a;
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
create temporary table t3 (a int);
create temporary table t4 (a int) select * from t3;
insert into t3 values(1);
insert into t4 select * from t3;
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
delete t1 from t1,t3 where t1.a=t3.a;
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
delete t3 from t1,t3 where t1.a=t3.a;
delete t4 from t3,t4 where t4.a=t3.a;
create temporary table t1 (a int);
insert into t1 values(1);
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
delete t1 from t1,t3 where t1.a=t3.a;
drop table t1;
insert into t1 values(1);
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
drop temporary table ttt;
ERROR 42S02: Unknown table 'ttt'
drop temporary table if exists ttt;
Warnings:
Note 1051 Unknown table 'ttt'
drop table t1,t2;
drop user test@localhost;
set global read_only=0;