Moodle

Some tag related columns are using bigint(11) as PK

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9.10
  • Component/s: Tags
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

While this shouldn't be critical, I've detected that some tags tables have some columns defined as BIGINT(11) and they should be BIGINT(10).

More exactly, incorrect columns are:

At install.xml:

tag->id
tag_correlation->id
tag_instance->id

At upgrade.php:

tag->id
tag->userid
tag_correlation->id
tag_correlation->tagid
tag_instance->id
tag_instance->tagid
tag_instance->itemid

There are two alternatives:

1) Don't perform any upgrade to fix this but fix the above mistakes to make new installs and upgrades to create DB structures properly.

2) Fix above mistakes and provide one upgrade step to fix them in servers running 1.9. Note that this step is complex because it includes changing PK columns and columns with indexes so perhaps the best approach is to:

  • rename current tables.
  • create the correct tables.
  • copy contents** (being careful with autonumeric ids that should be recalculated).
  • drop old tables.

IMO 1) could be enough, but 2) is the 100% correct solution. For your consideration.

Ciao

    • This means we must iterate over all the tags in wrong tables, inserting them in new tables and annotating all the old ids and new ids pairs to be used in the copy of the tag_instance and tag_correlation tables. We cannot perform the copy in one INSERT... SELECT statement. Must do that "manually".

Activity

Hide
Mathieu Petit-Clair added a comment -

I committed a fix that brings us to 1).

Show
Mathieu Petit-Clair added a comment - I committed a fix that brings us to 1).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: