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

postgres id sequence for workshop activity is not preserved while upgrading from 1.9 to 2.0

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5, 2.1.2, 2.2
    • Fix Version/s: 2.0.6, 2.1.3
    • Component/s: Workshop
    • Labels:
    • Environment:
    • Database:
      PostgreSQL
    • Testing Instructions:
      Hide

      1. On PostgreSQL, create new Moodle 1.9
      2. Create a course
      3. Create some Workshop instances (one should be enough, two or three should not hurt)
      4. Upgrade the site to the patched 2.0 or 2.1 or 2.2 Moodle
      5. TEST: make sure you can add another workshop instance

      Optional advance testing:

      • test other upgrade paths like 1.9 > non-patched 2.0 > (patched 2.0 or patched 2.1) etc
      • test on other databases: MySQL should not be affected by this issue but upgrade test would be nice, too. MSSQL and Oracle are probably affected by this issue, testing there would be nice to have on them, too.
      Show
      1. On PostgreSQL, create new Moodle 1.9 2. Create a course 3. Create some Workshop instances (one should be enough, two or three should not hurt) 4. Upgrade the site to the patched 2.0 or 2.1 or 2.2 Moodle 5. TEST: make sure you can add another workshop instance Optional advance testing: test other upgrade paths like 1.9 > non-patched 2.0 > (patched 2.0 or patched 2.1) etc test on other databases: MySQL should not be affected by this issue but upgrade test would be nice, too. MSSQL and Oracle are probably affected by this issue, testing there would be nice to have on them, too.
    • Workaround:
      Hide

      Setting the lastval attribute of the mdl_workshop_id_seq to the maximum value in the id column in mdl_workshop bypasses the problem:

      SELECT SETVAL( 'mdl_workshop_id_seq', (SELECT MAX( id ) + 1 AS last_value FROM mdl_workshop ), false );

      Show
      Setting the lastval attribute of the mdl_workshop_id_seq to the maximum value in the id column in mdl_workshop bypasses the problem: SELECT SETVAL( 'mdl_workshop_id_seq', (SELECT MAX( id ) + 1 AS last_value FROM mdl_workshop ), false );
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-29620-workshop-sequence

      Description

      What is not working
      -----------------------
      Upgrading a moodle 1.9.13 installation to 2.0.4 does not keep the values for the mdl_workshop_id_seq sequence (moodle instance is running on a postgresql database). This results in errors due to violations of the UNIQUE constraints for the primary key mdl_workshop.id when workshop instances are created after the upgrade has finished

      Expected behaviour
      -----------------------
      The values (esp. last_value) of the sequence for mdl_workshop_id_seq should be kept in order to ensure smooth and continous operation across updates

      Notes / Remarks
      ------------------------

      • Throughout this bugreport, I assume $CFG->prefix = 'mdl_' for the sake of breviety. Please adapt if necessary to the value used at your instances
      • Interestingly, the error seems to occur only while updating from 1.9.x -> 2.0.x. Updating the 2.0.4 instance to 2.1.1 left the sequence in the correct state

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  28/Nov/11