Moodle
  1. Moodle
  2. MDL-2742

survey module broken on postgres

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: None
    • Component/s: Survey
    • Labels:
      None
    • Environment:
      All
    • Database:
      PostgreSQL
    • Affected Branches:
      MOODLE_15_STABLE
    • Rank:
      8407

      Description

      I've just noticed that the survey module, the db/*.sql files do a whole lot of inserts, including the ID field.

      I don't know how mysql deals with this, but it breaks in postgres.

      In postgres, when you create a table with SERIAL PRIMARY KEY, it will automatically create a sequence for you. Doing a whole lot of inserts with ID hard coded gets the sequence out of sequence.

      Sometime today I will add in a reset for the sequence to the right number, someone with more mysql fu than me may want to change mysql.sql as well.

      IMHO, We should also change the db/*.sql files to not put ID into the sql at all and let the database deal with it, but going forward we definitely need to reset the sequence.

        Activity

        Hide
        Martin Dougiamas added a comment -

        From (penny at catalyst.net.nz) Wednesday, 16 March 2005, 07:15 AM:

        Committed a fix to stable & head:

        postgres7.php and postgres7.sql both reset the sequence. I didn't take the IDs out of the INSERTS in postgres7.sql because there are fks pointing to the IDs of the questions. Mysql.sql has been left alone.

        Will close in a few days .

        From (penny at catalyst.net.nz) Tuesday, 22 March 2005, 05:24 AM:

        ( closing )

        Show
        Martin Dougiamas added a comment - From (penny at catalyst.net.nz) Wednesday, 16 March 2005, 07:15 AM: Committed a fix to stable & head: postgres7.php and postgres7.sql both reset the sequence. I didn't take the IDs out of the INSERTS in postgres7.sql because there are fks pointing to the IDs of the questions. Mysql.sql has been left alone. Will close in a few days . From (penny at catalyst.net.nz) Tuesday, 22 March 2005, 05:24 AM: ( closing )

          People

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

            Dates

            • Created:
              Updated:
              Resolved: