Bug #41917 No warning is printed when 'CREATE TEMPORARY TABLE' is rolled back
Submitted: 7 Jan 2009 10:56 Modified: 7 Jan 2009 11:50
Reporter: Sven Sandberg Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Errors Severity:S2 (Serious)
Version:5.1+ OS:Any
Assigned to: CPU Architecture:Any
Tags: CREATE TEMPORARY TABLE, rollback, warning

[7 Jan 2009 10:56] Sven Sandberg
Description:
When normal non-transactional statements are part of a transaction, and get rolled back, there is a warning:

Warning	1196	Some non-transactional changed tables couldn't be rolled back

However, no warning is given when a CREATE TEMPORARY TABLE is part of a transaction and get rolled back.

Note: no warning is given when a CREATE TABLE (without TEMPORARY) is inside a BEGIN...ROLLBACK block either, but that's normal because CREATE TABLE does an implicit commit before and after, so it is in fact not rolled back. However, CREATE TEMPORARY TABLE does not do any implicit commit, so it is within the scope of the ROLLBACK. That justifies that there should be a warning.

How to repeat:
BEGIN;
  CREATE TEMPORARY TABLE t1 (a INT);   # Does not give any warning
ROLLBACK;
SELECT * FROM t1;

BEGIN;
  INSERT INTO t1 VALUES (1);           # Gives a warning
ROLLBACK;
SELECT * FROM t1;

Suggested fix:
Generate a warning when CREATE TEMPORARY TABLE is rolled back.
[7 Jan 2009 11:50] MySQL Verification Team
Thank you for the bug report. Verified as described.