-
Bug
-
Resolution: Fixed
-
Critical
-
2.5.1
-
MOODLE_25_STABLE
-
MOODLE_25_STABLE
-
Platform: Redhat Enterprise Linux 6.4 64 bit, PHP 5.3.3, MySQL 5.6
During the upgrade from 2.2.4+ to 2.5.1+, we encountered this error.
Default exception handler: DDL sql execution error Debug: Duplicate entry '679992' for key 'mdl_qtypmatcopti_que_uix'
CREATE UNIQUE INDEX mdl_qtypmatcopti_que_uix ON mdl_qtype_match_options (questionid)
Error code: ddlexecuteerror
Upon further investigation, I was informed that the mdl_qtype_match_options is a rename of the old question_match table for our version of 2.2.4+.
It would seem that the "questionid" field on mdl_qtype_match_options table for 2.5.1+ is related to the "question" field in the mdl_question_match table for 2.2.4+
So I ran a query to look for these duplicate "question" field values in the mdl_question_match table in our 2.2.4+.
Sure enough the dupes were there.
mysql> select id, question, subquestions from mdl_question_match where question in (select question from mdl_question_match group by question having count(question) > 1) order by question;
-------------------------------------------------------------------------
id | question | subquestions |
-------------------------------------------------------------------------
1422 | 679986 | 14164,14165,14166,14167,14168,14169,14170,14171,14172,14173 |
1426 | 679986 | 14189,14190,14191,14192,14193,14194,14195,14196,14197,14198 |
1423 | 679987 | 14174,14175,14176,14177,14178 |
1427 | 679987 | 14199,14200,14201,14202,14203 |
1424 | 679988 | 14179,14180,14181,14182,14183,14184,14185 |
1428 | 679988 | 14204,14205,14206,14207,14208,14209,14210 |
1425 | 679992 | 14186,14187,14188 |
1429 | 679992 | 14211,14212,14213 |
-------------------------------------------------------------------------
8 rows in set (0.31 sec)
It is important to fix or remove these duplicates in the question column before the upgrade because if I don't will get the "DDL sql execution error Debug: Duplicate entry 'XXXXXX' for key 'mdl_qtypmatcopti_que_uix'" where XXXXXX represents the question column field value error (ie. DDL sql execution error Debug: Duplicate entry '679992' for key 'mdl_qtypmatcopti_que_uix)
I want to find out which courses these records returned by my query are attached to so I could remove these quizzes or questions that are no longer needed to bypass the error.
Is this a bug or expected behaviour during the upgrade?
How could be resolve this other than actually deleting one of each duplicate record (could be dangerous as we don't know what we are deleting and what other situations it is tied to if we delete the record).
Thanks
- has a non-specific relationship to
-
MDL-40370 Upgrade to Moodle 2.5 breaks if question_shortanswer table contains duplicate rows
- Closed