Bug #79498 default_tmp_storage_engine not always respected
Submitted: 2 Dec 2015 23:21 Modified: 27 Aug 2019 23:36
Reporter: Trey Raymond Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Storage Engines Severity:S3 (Non-critical)
Version:5.6.24, 5.6.29, 5.7.11 OS:Any
Assigned to: CPU Architecture:Any

[2 Dec 2015 23:21] Trey Raymond
Description:
when creating a temp table that would have an invalid storage engine, the fallback is MyISAM, rather than the value of default_tmp_storage_engine which would be expected.  that's probably just hardcoded somewhere in very old code, and not noticed, as it's not a terribly common case.

How to repeat:
for example, a monitoring script that pulls snapshots of events_statements_summary_by_digest, which has engine "PERFORMANCE_SCHEMA" - not a valid choice to create.

show global variables like 'default%engine';
/*
default_storage_engine	InnoDB
default_tmp_storage_engine	InnoDB
*/
show create table performance_schema.events_statements_summary_by_digest;
/*
CREATE TABLE `events_statements_summary_by_digest` (
  `SCHEMA_NAME` varchar(64) DEFAULT NULL,
...
  `LAST_SEEN` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
*/
create temporary table t like performance_schema.events_statements_summary_by_digest;
show create table t;
/*
CREATE TEMPORARY TABLE `t` (
  `SCHEMA_NAME` varchar(64) DEFAULT NULL,
...
  `LAST_SEEN` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=utf8
*/

Suggested fix:
dig out wherever this is in the code (just have a nice long grep for string literal 'myisam' if need be) and have it respect the much newer variable setting.
[3 Dec 2015 7:56] MySQL Verification Team
Hello Trey Raymond,

Thank you for the report and test case.
Verified as described with 5.6.29 build.

Thanks,
Umesh
[27 Aug 2019 23:36] Trey Raymond
still an issue in 8.0.16