Is this correct that a "CREATE TEMPORARY TABLE IF NOT EXISTS.." does not commit current transaction (I like that), but a TRUNCATE TABLE, which is temporary, does implicitly commit any transaction?
Does this mean that the only way to have a fresh temporary table without committing the current transaction is to run (after above DDL statement):
DELETE FROM temp-table-name;
This TRUNCATE auto-commit behavior caused a rather nasty bug in my app -- the rollback didn't go all the way up because of the "TRUNCATE barrier" ;)
CREATE TEMPORARY TABLEandDROP TEMPORARY TABLE. The documentation saysCREATE TABLE and DROP TABLE statements do not commit a transaction if the TEMPORARY keyword is used. (This does not apply to other operations on temporary tables such as ALTER TABLE and CREATE INDEX, which do cause a commit.). This meansTRUNCATE TABLEwill cause implicit commit becasue it is not design to look under the hood and see that the table is temporary. Nice Work Around. +1 !!! – RolandoMySQLDBA Apr 24 '19 at 15:27