Error code: ddlexecuteerror

Error code: ddlexecuteerror

by Alessio Niespolo -
Number of replies: 3

I'm using Moodle 3.8.4+. I'm tring to duplicate an activity of a course by right-clicking on an activity and selecting Edit->Duplicate. I've set the debuggind mode to DEVELOPER, then I can see the complete error message:

Unknown table 'learn_nprod.mdl_backup_ids_temp'
DROP TABLE mdl_backup_ids_temp
Error code: ddlexecuteerror
* line 492 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown
* line 1072 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
* line 77 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
* line 332 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
* line 171 of /backup/util/dbops/backup_controller_dbops.class.php: call to database_manager->drop_table()
* line 40 of /backup/moodle2/backup_stepslib.php: call to backup_controller_dbops::drop_backup_ids_temp_table()
* line 34 of /backup/util/plan/backup_execution_step.class.php: call to create_and_clean_temp_stuff->define_execution()
* line 181 of /backup/util/plan/base_task.class.php: call to backup_execution_step->execute()
* line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 119 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
* line 375 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
* line 3530 of /course/lib.php: call to backup_controller->execute_plan()
* line 3518 of /course/externallib.php: call to duplicate_module()
* line 250 of /lib/externallib.php: call to core_course_external::edit_module()
* line 79 of /lib/ajax/service.php: call to external_api::call_external_function()

The table  learn_nprod.mdl_backup_ids_temp does not exists in my database.

How can I fix it?

Average of ratings: -
In reply to Alessio Niespolo

Ri: Error code: ddlexecuteerror

by Alessio Niespolo -
I've executed the "GRANT CREATE TEMPORARY" sql command and now the error is a bit different:

Error

In reply to Alessio Niespolo

Re: Ri: Error code: ddlexecuteerror

by Landon Dorssey -

I am experiencing this identical error. So far, I am seeing it as a permissions-related issue, but it is not something fixable within Moodle itself. It seems to be more closely related to the database and the development files supporting your Moodle. I'd also love support on this, as it is not an easy fix, and there is not very strong documentation on the error and solutions.

Best,

Landon

In reply to Landon Dorssey

Ri: Re: Ri: Error code: ddlexecuteerror

by Alessio Niespolo -
I've find a workaroud by modifing the file mysqli_native_moodle_database.php.
The following code line was the original one, in the get_tables function:

$sql = "SHOW TABLES LIKE '$prefix%'";
I've changed it as follows and the problem disappeared:

$sql = "SHOW FULL TABLES LIKE '$prefix%'";
But after the change, a new mdl_backup_ids_temp and mdl_backup_files_temp tables were created.
Then many tables with the same name existed after different activites duplications.
The restart of the server didn't change the situation (the db is on azure).
But after some hours and a second restart, the tables disappeard!
After that, I've reverted the changes in the php file and the problems not exist anymore! The duplication of an activity is possible and the tmp tables don't exist.
Any type of comments are appreciated