Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.9
-
Fix Version/s: None
-
Component/s: Database SQL/XMLDB
-
Labels:None
-
Database:Any
-
Affected Branches:MOODLE_19_STABLE
Description
The Course ID Number field that you can edit in settings is not enforced as unique, so you can have multiple courses with the same Course ID Number.
This may be intentional, but you could also argue that an ID number is by definition unique. Certainly whoever coded the following functionality thought so:
http://moodle.org/course/view.php?idnumber=USING001
This link takes you to the course with that idnumber. If you have two courses with the same id number it returns an error: "invalid course id number" and the following text if debugging is on:
"Error: Turn off debugging to hide this error.
SELECT * FROM mdl_course WHERE idnumber = '12345'(with limits 0, 100)
Found more than one record in get_record_sql !"
If this is intended to be unique and fixed then code that ensures uniqueness on creation, edits and backup/restore, similar to the shortname code, will need to be added, as well as a one time fix for existing duplicates. The database should also be updated to enforce this uniqueness as raised in the linked bug about course shortnames.
Issue Links
| This issue has a clone: | ||||
| MDL-14083 | Course Shortname is unique in interface and code but not in database schema |
|
|
|
Hi David,
about DB enforcing uniqueness, please take a look to
MDL-14083for an explanation. Hope it helps.About this (course->idnumber)... do you say that the course configuration page doesn't enforce uniqueness? Uhm... really I see the point about enforcing it... but I also think we have discussed this in the past... adding some people here... stay tuned.
MDL-14083for an explanation. Hope it helps. About this (course->idnumber)... do you say that the course configuration page doesn't enforce uniqueness? Uhm... really I see the point about enforcing it... but I also think we have discussed this in the past... adding some people here... stay tuned.