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

Database error when deleting users

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_31_STABLE

      Description

      We tried to delete all users except site admins on Moodle but it threw out some database error. We tried deleting them through bulk users action and upload users via csv with deleted=1, neither of them worked. Here is the stack trace:

      Debug info: SELECT id,category FROM

      {course}

      WHERE id IS NULL
      [array (
      )]
      Error code: invalidrecord
      ×Stack trace:
      line 1502 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1478 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 6952 of /lib/accesslib.php: call to moodle_database->get_record()
      line 70 of /lib/classes/event/grade_deleted.php: call to context_course::instance()
      line 1036 of /lib/grade/grade_grade.php: call to core\event\grade_deleted::create_from_grade()
      line 1484 of /lib/gradelib.php: call to grade_grade->delete()
      line 3951 of /lib/moodlelib.php: call to grade_user_delete()
      line 30 of /admin/user/user_bulk_delete.php: call to delete_user()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              shatami Pingtao Ye
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: