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

Avoid duplicate index names in upgrade under MySQL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 1.8.1, 1.9
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Environment:
      MySQL
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      In MDL-7376 the isNameInUse($object_name, $type) was introduced for PostgreSQL, MS-SQL and Oracle to avoid generating duplicate names when creating DB objects.

      This check was skipped for MySQL, because in that DB, indexes "belong" to tables, so it's possible to have "duplicates" belonging to different tables.

      But duplicates can, also, happen in the same tables. One proof:

      • We have table XXX, with one index over the userid field. It will be named: XXX_use_ix.
      • We add one new field, username, and try to create one index over it: XXX_use_ix will be used too. Conflict!!

      So, it's required to implement the isNameInUse() function for MySQL.

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Tester:
            Nobody
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              11/Jun/07