| 1 |
SELECT @@SESSION.binlog_format; |
| 2 |
@@SESSION.binlog_format |
| 3 |
MIXED |
| 4 |
CREATE TABLE t1 (a VARCHAR(100)); |
| 5 |
CREATE TEMPORARY TABLE t2 (a VARCHAR(100)); |
| 6 |
# Test allow switching @@SESSION.binlog_format from MIXED to STATEMENT |
| 7 |
# when there are open temp tables and we are logging in statement based format. |
| 8 |
SET SESSION binlog_format = STATEMENT; |
| 9 |
SELECT @@SESSION.binlog_format; |
| 10 |
@@SESSION.binlog_format |
| 11 |
STATEMENT |
| 12 |
# Test allow switching @@SESSION.binlog_format from STATEMENT to |
| 13 |
# STATEMENT when there are open temp tables. |
| 14 |
SET SESSION binlog_format = STATEMENT; |
| 15 |
SELECT @@SESSION.binlog_format; |
| 16 |
@@SESSION.binlog_format |
| 17 |
STATEMENT |
| 18 |
INSERT INTO t1 VALUES ('statement based'); |
| 19 |
SELECT @@SESSION.binlog_format; |
| 20 |
@@SESSION.binlog_format |
| 21 |
STATEMENT |
| 22 |
# Test allow switching @@SESSION.binlog_format from STATEMENT to |
| 23 |
# MIXED when there are open temp tables. |
| 24 |
SET SESSION binlog_format = MIXED; |
| 25 |
SELECT @@SESSION.binlog_format; |
| 26 |
@@SESSION.binlog_format |
| 27 |
MIXED |
| 28 |
# Test allow switching @@SESSION.binlog_format from MIXED to MIXED |
| 29 |
# when there are open temp tables. |
| 30 |
SET SESSION binlog_format = MIXED; |
| 31 |
SELECT @@SESSION.binlog_format; |
| 32 |
@@SESSION.binlog_format |
| 33 |
MIXED |
| 34 |
INSERT INTO t2 VALUES (UUID()); |
| 35 |
SELECT @@SESSION.binlog_format; |
| 36 |
@@SESSION.binlog_format |
| 37 |
MIXED |
| 38 |
# Test forbit switching @@SESSION.binlog_format from MIXED to STATEMENT |
| 39 |
# when there are open temp tables and we are logging in row based format. |
| 40 |
SET SESSION binlog_format = STATEMENT; |
| 41 |
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables |
| 42 |
SELECT @@SESSION.binlog_format; |
| 43 |
@@SESSION.binlog_format |
| 44 |
MIXED |
| 45 |
SET SESSION binlog_format = ROW; |
| 46 |
SELECT @@SESSION.binlog_format; |
| 47 |
@@SESSION.binlog_format |
| 48 |
ROW |
| 49 |
INSERT INTO t1 VALUES ('row based'); |
| 50 |
# Test allow switching @@SESSION.binlog_format from ROW to MIXED |
| 51 |
# when there are open temp tables. |
| 52 |
SET SESSION binlog_format = MIXED; |
| 53 |
SELECT @@SESSION.binlog_format; |
| 54 |
@@SESSION.binlog_format |
| 55 |
MIXED |
| 56 |
INSERT INTO t1 VALUES ('row based'); |
| 57 |
# Test allow switching @@SESSION.binlog_format from MIXED to ROW |
| 58 |
# when there are open temp tables. |
| 59 |
SET SESSION binlog_format = ROW; |
| 60 |
SELECT @@SESSION.binlog_format; |
| 61 |
@@SESSION.binlog_format |
| 62 |
ROW |
| 63 |
# Test allow switching @@SESSION.binlog_format from ROW to ROW |
| 64 |
# when there are open temp tables. |
| 65 |
SET SESSION binlog_format = ROW; |
| 66 |
SELECT @@SESSION.binlog_format; |
| 67 |
@@SESSION.binlog_format |
| 68 |
ROW |
| 69 |
INSERT INTO t1 VALUES ('row based'); |
| 70 |
# Test forbit switching @@SESSION.binlog_format from ROW to STATEMENT |
| 71 |
# when there are open temp tables. |
| 72 |
SET SESSION binlog_format = STATEMENT; |
| 73 |
ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables |
| 74 |
SELECT @@SESSION.binlog_format; |
| 75 |
@@SESSION.binlog_format |
| 76 |
ROW |
| 77 |
DROP TEMPORARY TABLE t2; |
| 78 |
DROP TABLE t1; |