When passing an XMLDBTable table object with indexes to function create_temp_table() (lib/ddllib.php), errors are encountered.
This is because of:
$sqlarr = preg_replace('/^CREATE/', "CREATE $temporary", $sqlarr)
which will also cause index creation statements to be changed to something like "CREATE TEMPORARY INDEX..." to "CREATE GLOBAL TEMPORARY INDEX...".
This will be an issue with all db types, except for mssql where $temporary variable is set to ''.
Please see the attached patch that might fix the issue.