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

Duplicate key constraints violation when importing multiple questions in a new category

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.6
    • 3.6
    • Questions

      I ecported the questions from the 3.0 New question types category at https://qa.moodle.net/question/edit.php?courseid=2&cat=12%2C25 and attempted to import into my local site:

      Debug info: ERROR: duplicate key value violates unique constraint "mdl_ques_catidn_uix"
      DETAIL: Key (category, idnumber)=(10, ) already exists.
      INSERT INTO mdl_question (defaultmark,questiontextformat,generalfeedback,generalfeedbackformat,penalty,length,name,questiontext,idnumber,qtype,category,stamp,createdby,timecreated,modifiedby,timemodified) VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16) RETURNING id
      [array (
      'defaultmark' => '1.0000000',
      'questiontextformat' => '1',
      'generalfeedback' => '',
      'generalfeedbackformat' => '1',
      'penalty' => 0.3333333,
      'length' => 1,
      'name' => 'Types of geography',
      'questiontext' => '<p>Drag the words relating to each type of geography to the correct notepad.</p><p>This is an example of a <a href="https://docs.moodle.org/en/Drag_and_drop_marker_question_type">Drag and drop marker question type.</a>&nbsp;In this example, several markers can be dropped into the same region.</p>',
      'idnumber' => '',
      'qtype' => 'ddmarker',
      'category' => '10',
      'stamp' => 'boysenberry.local+181024024558+4FhEeD',
      'createdby' => '2',
      'timecreated' => 1540349158,
      'modifiedby' => '2',
      'timemodified' => 1540349158,
      )]
      Error code: dmlwriteexception
      

      Stack trace:
      line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 248 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
      line 969 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
      line 1017 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
      line 422 of /question/format.php: call to pgsql_native_moodle_database->insert_record()
      line 123 of /question/import.php: call to qformat_default->importprocess()
      

            timhunt Tim Hunt
            dobedobedoh Andrew Lyons
            John Beedell John Beedell (Inactive)
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            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.