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

Restore of forum logs fails with error: invalid input syntax for integer

    XMLWordPrintable

    Details

    • Database:
      PostgreSQL
    • Workaround:
      Hide

      Deselect the option to restore course logs when restoring.

      Show
      Deselect the option to restore course logs when restoring.
    • Affected Branches:
      MOODLE_25_STABLE

      Description

      Full error:

      Debug info: ERROR: invalid input syntax for integer: "{forum_discussion}#p{forum_post}"
      SELECT * FROM mdl_backup_ids_temp WHERE backupid = $1 AND itemname = $2 AND itemid = $3
      [array (
      0 => 'c1529940e3dab71f8efef5db00f4c25f',
      1 => 'forum_discussion',
      2 => '{forum_discussion}#p{forum_post}',
      )]
      Error code: dmlreadexception
      Stack trace:
      line 423 of /lib/dml/moodle_database.php: dml_read_exception thrown
      line 248 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 753 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 1397 of /lib/dml/moodle_database.php: call to pgsql_native_moodle_database->get_records_sql()
      line 1369 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1348 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 223 of /backup/util/dbops/restore_dbops.class.php: call to moodle_database->get_record()
      line 1511 of /backup/util/dbops/restore_dbops.class.php: call to restore_dbops::get_backup_ids_cached()
      line 197 of /backup/util/helper/restore_log_rule.class.php: call to restore_dbops::get_backup_ids_record()
      line 137 of /backup/util/helper/restore_log_rule.class.php: call to restore_log_rule->parse_tokens_and_matches()
      line 84 of /backup/util/helper/restore_logs_processor.class.php: call to restore_log_rule->process()
      line 2555 of /backup/moodle2/restore_stepslib.php: call to restore_logs_processor->process_log_record()
      line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_activity_logs_structure_step->process_log()
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
      line 151 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
      line 91 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 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
      line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
      line ? of unknownfile: call to progressive_parser->end_tag()
      line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
      line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
      line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
      line 192 of /backup/moodle2/restore_activity_task.class.php: call to base_task->execute()
      line 167 of /backup/util/plan/base_plan.class.php: call to restore_activity_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()
      

      I tracked down the entry in the source database (from the Moodle that created the backup file), it is:

         id    |    time    | userid |      ip      | course | module |  cmid  |   action    |                    url                     |  info
      ---------+------------+--------+--------------+--------+--------+--------+-------------+--------------------------------------------+--------
       7525025 | 1378796360 |  25675 | 1.2.3.4 |   8223 | forum  | 286790 | update post | discuss.php?d=107533#p183098&parent=183098 | 183098
      

      This is represented in the backup file like this:

        <log id="7525025">
          <time>1378796360</time>
          <userid>25675</userid>
          <ip>1.2.3.4</ip>
          <module>forum</module>
          <action>update post</action>
          <url>discuss.php?d=107533#p183098&amp;parent=183098</url>
          <info>183098</info>
        </log>
      

      I spent some time trying to debug it, but didn't find a solution. Perhaps someone more familiar with the forum backup / restore code should look at it.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              brianking Brian King
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated: