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

dml_write_exception thrown

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
    • Environment:
      Centos 5.6
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Log in as site administrator, create a course, the error appears.

      Show
      Log in as site administrator, create a course, the error appears.
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      I recently upgraded Moodle from 1.9 to 2.0.2 (Build: 20110221. I have noticed a number of "Error writing to database" errors when creating and deleting new courses. The stange thing is that it seems like the courses have been created and seem to function normally. I have now just upgraded to 2.1, but the problem persists.

      I turned on debugging and I get this when I delete a course:

      Deleting atest
      Deleted - Grades, Items, Categories
      Deleted - Outcomes
      Deleted - Scales
      Deleted - Settings
      Deleted - Letters
      Deleted 0 x assignment
      Deleted 0 x chat
      Deleted 0 x choice
      Deleted 0 x forum
      Deleted 0 x glossary
      Deleted 0 x label
      Deleted 0 x lesson
      Deleted 0 x quiz
      Deleted 0 x resource
      Deleted 0 x scorm
      Deleted 0 x survey
      Deleted 0 x wiki
      Deleted 0 x workshop
      Deleted 0 x feedback
      Deleted 0 x data
      Deleted 0 x folder
      Deleted 0 x imscp
      Deleted 0 x page
      Deleted 0 x url
      Deleted groupings
      Deleted groupings_groups
      Deleted groups_members
      Deleted groups
      Deleted - course tags

      Error writing to database

      More information about this error
      Debug info: Duplicate entry '5-200001' for key 2
      UPDATE mdl_course
      SET sortorder = sortorder + 1
      WHERE category = ?
      [array (
      0 => '5',
      )]
      Stack trace:

      line 396 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 707 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1095 of /lib/datalib.php: call to mysqli_native_moodle_database->execute()
      line 74 of /course/delete.php: call to fix_course_sortorder()

      and this when I create courses:

      Debug info: Duplicate entry '4-250000' for key 2
      UPDATE mdl_course
      SET sortorder = ((sortorder) % (10000)) + ?
      WHERE category = ?
      [array (
      0 => '250000',
      1 => '4',
      )]
      Stack trace:

      line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 707 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1066 of /lib/datalib.php: call to mysqli_native_moodle_database->execute()
      line 3712 of /course/lib.php: call to fix_course_sortorder()
      line 111 of /course/edit.php: call to create_course()

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: