Debian Codegraph @

mysql-test/suite/binlog/r/binlog_dmls_on_tmp_tables_readonly.result

raw
1 DROP TABLE IF EXISTS t1 ;
2 # READ_ONLY does nothing to SUPER users
3 # so we use a non-SUPER one:
4 CREATE USER test@localhost;
5 GRANT CREATE, SELECT, DROP ON *.* TO test@localhost;
6 connect con1,localhost,test,,test;
7 connection default;
8 SET GLOBAL READ_ONLY=1;
9 connection con1;
10 CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB;
11 # Test INSERTS with autocommit being off and on.
12 BEGIN;
13 INSERT INTO t1 VALUES (10);
14 COMMIT;
15 INSERT INTO t1 VALUES (20);
16 # Test UPDATES with autocommit being off and on.
17 BEGIN;
18 UPDATE t1 SET a=30 WHERE a=10;
19 COMMIT;
20 UPDATE t1 SET a=40 WHERE a=20;
21 connection default;
22 SET GLOBAL READ_ONLY=0;
23 # Test scenario where global read_only is enabled in the middle of transaction.
24 # Test INSERT operations on temporary tables, INSERTs should be successful even
25 # when global read_only is enabled.
26 connection con1;
27 BEGIN;
28 INSERT INTO t1 VALUES(50);
29 connection default;
30 SET GLOBAL READ_ONLY=1;
31 connection con1;
32 SELECT @@GLOBAL.READ_ONLY;
33 @@GLOBAL.READ_ONLY
34 1
35 COMMIT;
36 connection default;
37 SET GLOBAL READ_ONLY=0;
38 # Test UPDATE operations on temporary tables, UPDATEs should be successful even
39 # when global read_only is enabled.
40 connection con1;
41 BEGIN;
42 UPDATE t1 SET a=60 WHERE a=50;
43 connection default;
44 SET GLOBAL READ_ONLY=1;
45 connection con1;
46 SELECT @@GLOBAL.READ_ONLY;
47 @@GLOBAL.READ_ONLY
48 1
49 COMMIT;
50 SELECT * FROM t1;
51 a
52 30
53 40
54 60
55 # Clean up
56 connection default;
57 SET GLOBAL READ_ONLY=0;
58 disconnect con1;
59 DROP USER test@localhost;