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

Backup error: invalid input syntax for integer: "" during restore of multianswer question

XMLWordPrintable

    • MOODLE_21_STABLE, MOODLE_27_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE
    • MOODLE_30_STABLE, MOODLE_31_STABLE
    • MDL-35987-master
    • Hide

      Prerequisites

      1. In any Moodle <= 2.9
      2. Create a quiz in a new course
      3. Populate the quiz with a few Cloze questions
      4. In the database, change mdl_question_multianswer:sequence of B and D to respectively empty and ,,,.
      5. Backup your course

      Test

      1. Restore the backup
      2. Confirm that the restore finished without error
      3. Confirm that the backup logs informs you that the multianswer questions B and D had an invalid sequence
      4. Confirm that the other questions did not generate a notice in the logs
      Show
      Prerequisites In any Moodle <= 2.9 Create a quiz in a new course Populate the quiz with a few Cloze questions https://docs.moodle.org/29/en/Embedded_Answers_%28Cloze%29_question_type A, B with only one embedded question (the sequence will not contain any comma) C, D with more than one embedded question (the sequence will contain comma) In the database, change mdl_question_multianswer:sequence of B and D to respectively empty and ,,, . Backup your course Test Restore the backup Confirm that the restore finished without error Confirm that the backup logs informs you that the multianswer questions B and D had an invalid sequence Confirm that the other questions did not generate a notice in the logs
    • 3.2 Sprint 1

      After performing a restore on a course I am receiving the following error:

      Default exception handler: Error reading from database Debug: ERROR:  invalid input syntax for integer: ""
      SELECT * FROM mdl_backup_ids_temp WHERE backupid = $1 AND itemname = $2 AND itemid = $3
       [array (
         0 => 'ecdcf30e7a1ffa5d5b41821d95f9b7d4',
         1 => 'question',
         2 => '',
       )]
       * line 396 of /lib/dml/moodle_database.php: dml_read_exception thrown
       * line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
       * line 681 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
       * line 1296 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
       * line 1268 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
       * line 1248 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
       * line 1259 of /backup/util/dbops/restore_dbops.class.php: call to moodle_database->get_record()
       * line 213 of /backup/util/plan/restore_structure_step.class.php: call to restore_dbops::get_backup_ids_record()
       * line 205 of /backup/util/plan/restore_structure_step.class.php: call to restore_structure_step->get_mapping()
       * line 199 of /backup/moodle2/restore_plugin.class.php: call to restore_structure_step->get_mappingid()
       * line 108 of /question/type/multianswer/backup/moodle2/restore_qtype_multianswer_plugin.class.php: call to restore_plugin->get_mappingid()
       * line 79 of /backup/moodle2/restore_plugin.class.php: call to restore_qtype_multianswer_plugin->after_execute_question()
       * line 355 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 146 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 63 of /batchrestore/autorestore.php: call to restore_controller->execute_plan()
       * line 90 of /batchrestore/batchrestore20.php: call to restore_course()

      The error is a duplicate of http://tracker.moodle.org/browse/MDL-26587 but is in reference to the multianswer not the short answer like the original ticket is. However the fix is the same just needs to be applied to a different file. The version I am using is 2.1.6 but the issue seems to be in all version up to and including 2.3.X.

      I have tested this and here is a link to my commit. This should cherry-pick cleanly to the MOODLE_22_STABLE and MOODLE_23_STABLE.
      https://github.com/mdikih/moodle/commit/23b51f8411070da65a24dac9436f09dcc04fda13

      Thank you.

            fred Frédéric Massart
            mdikih Michael Wylde
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Rajesh Taneja Rajesh Taneja
            Votes:
            10 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved:

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