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

Restoring 1.9 backup to 2.2 postgresq fails (null value in column "hiddensections" violates not-null constraint)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.1.5, 2.2.2
    • 2.0.7, 2.1.4, 2.2.1
    • Backup
    • PostgreSQL
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide

      Attached patch. I don't know current moodle codebase well, so maybe this
      should fixed earlier stage where data is parsed. But any how, attached patch will fix the issue.

      Show
      Attached patch. I don't know current moodle codebase well, so maybe this should fixed earlier stage where data is parsed. But any how, attached patch will fix the issue.
    • Hide

      Try to restore the "hacked" backup file (null_hidden_sections.mbz). It has been forced to have the course->hiddensections tag to null.

      1) without the patch, it will lead to DB error about NULL value not allowed.
      2) with the fix applied, it will restore without error.

      Show
      Try to restore the "hacked" backup file (null_hidden_sections.mbz). It has been forced to have the course->hiddensections tag to null. 1) without the patch, it will lead to DB error about NULL value not allowed. 2) with the fix applied, it will restore without error.

      Trying to restore backup from moodle 1.9.x to moodle 2.2 with postgresql database.
      Got error:

      Error: null value in column "hiddensections" violates not-null constraint
       
      UPDATE mdl_course SET summaryformat = $1,legacyfiles = $2,requested = $3,restrictmodules = $4,enablecompletion = $5,completionstartonenrol = $6,completionnotify = $7,fullname = $8,shortname = $9,idnumber = $10,summary = $11,format = $12,showgrades = $13,newsitems = $14,startdate = $15,numsections = $16,maxbytes = $17,showreports = $18,groupmode = $19,groupmodeforce = $20,defaultgroupingid = $21,lang = $22,theme = $23,marker = $24,visible = $25,hiddensections = $26,timecreated = $27,timemodified = $28 WHERE id=$29\n[array (\n  'summaryformat' => '1',\n  'legacyfiles' => '2',\n  'requested' => '0',\n  'restrictmodules' => 0,\n  'enablecompletion' => 0,\n  'completionstartonenrol' => 0,\n  'completionnotify' => 0,\n  'fullname' => 'Osa 2: Tekninen piirustus (WinNova, Rauma/aikuiskoulutus)',\n  'shortname' => 'Tekn.piir. (WR_a)',\n  'idnumber' => '',\n  'summary' => ' Teknisen piirustuksen verkko-opetusaineisto kattaa kone- ja metallialan perustutkintoon sis\xc3\xa4ltyv\xc3\xa4n tietopuolisen opetuksen. Moodle-istunto on WinNovan (Rauma/aikuiskoulutus) kone- ja metallialan opiskelijoiden ja opettajien yhteinen teknisen piirustuksen opiskelualusta.',\n  'format' => 'topics',\n  'showgrades' => '1',\n  'newsitems' => '5',\n  'startdate' => 1321480800,\n  'numsections' => '14',\n  'maxbytes' => '5242880',\n  'showreports' => '0',\n  'groupmode' => '0',\n  'groupmodeforce' => '0',\n  'defaultgroupingid' => '0',\n  'lang' => '',\n  'theme' => '',\n  'marker' => '0',\n  'visible' => '1',\n  'hiddensections' => NULL,\n  'timecreated' => '1321439425',\n  'timemodified' => '1321444267',\n  0 => 941,\n)]\n* line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown\n* 
      line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()\n* 
      line 936 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()\n* 
      line 976 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->update_record_raw()\n* 
      line 1150 of /backup/moodle2/restore_stepslib.php: call to pgsql_native_moodle_database->update_record()\n* 
      line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_course_structure_step->process_course()\n* 
      line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()\n* 
      line 125 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()\n* 
      line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()\n* 
      line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()\n* 
      line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()\n* 
      line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()\n* '
      line 212 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()\n* 
      line ? of unknownfile: call to progressive_parser->start_tag()\n* line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()\n* 
      line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()\n* 
       
      line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()\n* 
      line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()\n* 
      line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()\n* line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()\n* line 310 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()\n* line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()\n* line 46 of /backup/restore.php: call to restore_ui->execute()\n, referer: http://moodle.sataedu.fi/backup/restore.php

            stronk7 Eloy Lafuente (stronk7)
            paca70 Petri Asikainen
            Sam Hemelryk Sam Hemelryk
            Aparup Banerjee Aparup Banerjee
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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