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

add IF EXISTS in getRenameTableExtraSQL in /lib/ddl/postgres_sql_generator.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.8.2
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_38_STABLE

      Description

      This function assumes all id fields are autoincrement sequences, but some may not be. In my plugin's case, my table is just referencing the id in another moodle table. When trying to rename this particular table the operation fails because there is no <table name>_id_seq , so I suggest the line 246 becomes:

      $results[] = 'ALTER TABLE IF EXISTS ' . $oldseqname . ' RENAME TO ' . $newseqname;

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            luciangabrielpricop Lucian Gabriel Pricop
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: