Bug #68598 temporary tables allowed with gtid-mode=ON?
Submitted: 7 Mar 2013 15:07 Modified: 5 Apr 2013 9:17
Reporter: Kolbe Kegel Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.6.10 OS:Any
Assigned to: Jon Stephens CPU Architecture:Any

[7 Mar 2013 15:07] Kolbe Kegel
Description:
http://dev.mysql.com/doc/refman/5.6/en/replication-gtids-restrictions.html claims "CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE statements are not supported when using GTIDs", yet I have no problem at all executing either of those statements with gtid_mode=ON, using either "row" or "statement" binlog_format, as long as they're executed *outside* of an explicit transaction.

How to repeat:
commit;
set autocommit=1;
create temporary table temp1 (id int) engine=innodb;
drop temporary table temp1;

begin;
create temporary table temp1 (id int) engine=innodb;
rollback;

begin;
drop temporary table temp1;
rollback;

box1> commit;
Query OK, 0 rows affected (0.00 sec)

box1> set autocommit=1;
Query OK, 0 rows affected (0.00 sec)

box1> create temporary table temp1 (id int) engine=innodb;
Query OK, 0 rows affected (0.01 sec)

box1> drop temporary table temp1;
Query OK, 0 rows affected (0.00 sec)

box1>
box1> begin;
Query OK, 0 rows affected (0.00 sec)

box1> create temporary table temp1 (id int) engine=innodb;
ERROR 1787 (HY000): When ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.
box1> rollback;
Query OK, 0 rows affected (0.00 sec)

box1>
box1> begin;
Query OK, 0 rows affected (0.00 sec)

box1> drop temporary table temp1;
ERROR 1787 (HY000): When ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.
box1> rollback;
Query OK, 0 rows affected (0.00 sec)

Suggested fix:
The documentation should state "CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE statements are not supported inside transactions when using GTIDs" and should clarify that they *are* allowed when *not* used inside transactions.

The page then goes on to say "While it is possible to execute these statements inside a transaction", which doesn't seem to be true, so that should be changed as well.
[7 Mar 2013 15:28] Kolbe Kegel
Changed Category to Server-Documentation.
[8 Mar 2013 11:06] Erlend Dahl
Thank you for the bug report.
[5 Apr 2013 9:17] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.
[5 Apr 2013 9:18] Jon Stephens
Fixed in mysqldoc rev 34845.