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

Copy a course: duplicate key value violates unique constraint "mdl_forusubs_usefor_uix"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 3.3.3, 3.3.4
    • Administration, Backup, Forum
    • MOODLE_33_STABLE

      When trying to copy a number of courses (backup and restore them as a new course) with user data and forum subscriptions, Moodle returns this error message while restoring the course:

       
      Error writing to database
      ×Debug info: ERROR: duplicate key value violates unique constraint "mdl_forusubs_usefor_uix"
      DETAIL: Key (userid, forum)=(<<ID>>, <<ID>>) already exists.
      INSERT INTO mdl_forum_subscriptions (userid,forum) VALUES($1,$2) RETURNING id
      [array (
      'userid' => '<<ID>>',
      'forum' => <<ID>>,
      )]
      Error code: dmlwriteexception
      Steps to reproduce:

      1. Backup a course which includes user data and forum subscriptions
      2. Restore the backup as a new course including user data. Moodle should give the above mentioned error message.

      I was hoping that this issue was fixed with MDL-60669, but it's still here (having Moodle 3.3.4).

            jbarcega Janelle Barcega
            wsam@zhaw.ch Samuel Witzig
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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