Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84557

DB error when copying a course with subsections

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.5
    • Backup, Subsection
    • None
    • MOODLE_405_STABLE

      When trying to copy a course or restore a backup of a course with subsections we get a DB error complaining about a duplicated value on an index on the course_sections table:

       

      Execute adhoc task: core\task\asynchronous_copy_task
      Adhoc task id: 33308
      Adhoc task custom data: {"backupid":"edf9c0ea66de3ff40bf1d33301dc34b5","restoreid":"b5f9203062003e4d3826bc4d7c5ab913"}
      ... started 12:04:45. Current memory use 47.1 MB.
      Course copy: Processing asynchronous course copy for course id: 505
      Course copy: Backing up course, id: 505
      Course copy: Restoring into course, id: 509
      ... used 4010 dbqueries
      ... used 0.85794401168823 seconds
      Adhoc task failed: core\task\asynchronous_copy_task,Errorea datu-basean idaztean (ERROR:  duplicate key value violates unique constraint "m_coursect_cousec_uix"
      DETAIL:  Key (course, section)=(509, 2) already exists.
      UPDATE m_course_sections SET section = $1 WHERE id=$2
      [array (
        'section' => 2,
        0 => '1724',
      )])
      Debug info:
      ERROR:  duplicate key value violates unique constraint "m_coursect_cousec_uix"
      DETAIL:  Key (course, section)=(509, 2) already exists.
      UPDATE m_course_sections SET section = $1 WHERE id=$2
      [array (
        'section' => 2,
        0 => '1724',
      )]
      Backtrace:
       
      line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end() line 358 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end() line 1358 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 1392 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->update_record_raw() line 1865 of /backup/moodle2/restore_stepslib.php: call to pgsql_native_moodle_database->update_record() line 1662 of /backup/moodle2/restore_stepslib.php: call to restore_section_structure_step->displace_delegated_sections_after() line 137 of /backup/util/plan/restore_structure_step.class.php: call to restore_section_structure_step->process_section() line 123 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process() line 178 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk() line 111 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk() line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk() line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk() line 189 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk() line 277 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish() line ? of unknownfile: call to progressive_parser->end_tag() line 178 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse() line 157 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse() line 110 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process() line 199 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute() line 122 of /backup/moodle2/restore_section_task.class.php: call to base_task->execute() line 191 of /backup/util/plan/base_plan.class.php: call to restore_section_task->execute() line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute() line 411 of /backup/controller/restore_controller.class.php: call to restore_plan->execute() line 138 of /lib/classes/task/asynchronous_copy_task.php: call to restore_controller->execute_plan() line 519 of /lib/classes/cron.php: call to core\task\asynchronous_copy_task->execute() line 302 of /lib/classes/cron.php: call to core\cron::run_inner_adhoc_task() line 128 of /lib/classes/cron.php: call to core\cron::run_adhoc_tasks() line 186 of /admin/cli/cron.php: call to core\cron::run_main_process() 

       

      We are running Moodle 4.5.2 on PostgreSQL.

            Unassigned Unassigned
            izendegi Iñigo Zendegi Urzelai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.