As hinted in
MDEV-21602, CREATE TABLE...SELECT is currently implemented in multiple transactions:
- Transaction(s) to create (each partition or subpartition of) the table
- Another transaction to execute INSERT...SELECT
- If an error occurs: transaction(s) to execute handler::delete_table()
A cleaner solution would be to use a single transaction for the entire operation. If an error occurs, we would simply roll back the operation.