Moodle

can't create unique index on mdl_course_modules.idnumber

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.9, 2.0
  • Fix Version/s: 1.9, 2.0
  • Component/s: Database SQL/XMLDB
  • Labels:
    None
  • Database:
    Microsoft SQL
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

The install script for 1.9 fails on our system when it tries to had this index.

The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.mdl_course_modules' and the index name 'mdl_courmodu_idn_uix'. The duplicate key value is (<NULL>)

There is a idnumber column in the mdl_course_modules field, but it's not being used. All the values are NULL and therefore they aren't unique.

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Hi Alan,

I've reviewed the course_modules definition in the install.xml file and it hasn't any UNIQUE index over idnumber. In fact, I remember we detected this problem some weeks ago and changed it to ac composite idnumber-course non-unique alternative (enforcing uniqueness by code).

Can you explain if you were installing from scratch or upgrading from XXX to YYY versions? For sure we missed to change such unique index somewhere.

TIA and ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Alan, I've reviewed the course_modules definition in the install.xml file and it hasn't any UNIQUE index over idnumber. In fact, I remember we detected this problem some weeks ago and changed it to ac composite idnumber-course non-unique alternative (enforcing uniqueness by code). Can you explain if you were installing from scratch or upgrading from XXX to YYY versions? For sure we missed to change such unique index somewhere. TIA and ciao
Hide
Eloy Lafuente (stronk7) added a comment -

Aha,

I think I've found it, the index was created (wrongly) as part of the upgrade from previous versions. I've fixed that both in STABLE_19 and HEAD. Should be working now.

Closing, reopen if necessary. Thanks!

Show
Eloy Lafuente (stronk7) added a comment - Aha, I think I've found it, the index was created (wrongly) as part of the upgrade from previous versions. I've fixed that both in STABLE_19 and HEAD. Should be working now. Closing, reopen if necessary. Thanks!
Hide
Alan Trick added a comment -

Yeah, it works for me too

Show
Alan Trick added a comment - Yeah, it works for me too

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: