Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: error/moodle/error question answers missing in db.

error/moodle/error question answers missing in db: Difference between revisions

From MoodleDocs
(Created page with "This error means that you have records in your '''mdl_question_answers''' table that no longer have a matching question in the '''mdl_question''' table. Here's a way to find the...")
 
m (Added link to spanish translation of page)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
This error means that you have records in your '''mdl_question_answers''' table that no longer have a matching question in the '''mdl_question''' table. Here's a way to find them in MySQL (other databases may have a slightly different syntax):
This could mean that you have a question in your quiz or dataset that is not restoring properly.  


SELECT
mdl_question.id,
mdl_question_answers.id,
mdl_question_answers.question FROM
mdl_question_answers


Left Join mdl_question ON mdl_question_answers.question = mdl_question.id
== Possible solutions ==


WHERE
1. Restore the questions manually into your course and recreate the quiz.
mdl_question.id IS NULL


2. Try copying system level questions into the course.  Use the '''edit''' button and then click the '''Make copy''' button at the bottom of the page. Then try moving it. If that triggers an error, then you know which question is causing the problem.


I highly recommend that you make a copy of the '''mdl_question_answers''' table before you start deleting records.


Here's a way to delete those orphaned rows in the '''mdl_question_answers''':
== Other notes ==
The file that is throwing this error is /backup/moodle2/restore_qtype_plugin.class.php  around line 159.


DELETE mdl_question_answers.*
 
FROM mdl_question_answers
[[es:error/moodle/error question answers missing in db]]
LEFT JOIN mdl_question
ON mdl_question_answers.question = mdl_question.id
WHERE mdl_question.id IS NULL

Latest revision as of 14:10, 1 June 2015

This could mean that you have a question in your quiz or dataset that is not restoring properly.


Possible solutions

1. Restore the questions manually into your course and recreate the quiz.

2. Try copying system level questions into the course. Use the edit button and then click the Make copy button at the bottom of the page. Then try moving it. If that triggers an error, then you know which question is causing the problem.


Other notes

The file that is throwing this error is /backup/moodle2/restore_qtype_plugin.class.php around line 159.