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

On Large, heavily used installations, I am running into constraints related to the subquestions field in mdl_question_match

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.4.3
    • Questions
    • None
    • MOODLE_24_STABLE

      Restore fails with the following:
      Error writing to database

      More information about this error

      Debug info: Data too long for column 'subquestions' at row 1
      UPDATE mdl_question_match SET subquestions = ? WHERE id = ?
      [array (
      0 => '750773,750774,750775,750776,750777,750778,750779,750780,750781,750782,750783,750784,750785,750786,750787,750788,750789,750790,750791,750792,750793,750794,750795,750796,750797,750798,750799,750800,750801,750802,750803,750804,750805,750806,750807,750808,750809,750810,750811,750812,750813,750814',
      1 => '63860',
      )]
      Error code: dmlwriteexception
      Stack trace:
      line 429 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 1285 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1565 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->set_field_select()
      line 195 of /question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php: call to moodle_database->set_field()
      line 84 of /backup/moodle2/restore_plugin.class.php: call to restore_qtype_match_plugin->after_execute_question()
      line 362 of /backup/util/plan/restore_structure_step.class.php: call to restore_plugin->launch_after_execute_methods()
      line 108 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->launch_after_execute_methods()
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 163 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
      line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
      line 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
      line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
      line 46 of /backup/restore.php: call to restore_ui->execute()

      This appears to be related to the character limit on subquestions:

      subquestions varchar(255)

      As the subquestions auto increment up, on a heavily used site, the id's are now 6 characters long:

      select id, subquestions from mdl_question_match order by id desc limit 3;
      ------------------------------------------------+

      id subquestions

      ------------------------------------------------+

      63758 749518,749519,749520,749521,749522,749523
      63757 749513,749514,749515,749516,749517
      63756 749508,749509,749510,749511,749512

      As a result, restoring courses with a large number of subquestions is now failing.

            timhunt Tim Hunt
            matthew.burford@remote-learner.net Matthew Burford
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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