Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-13406

ADD INDEX syntax may cause an error in earlier MySQL versions

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1.2, 3.2.0-dev
    • Fix Version/s: 3.1.3-RC1
    • Component/s: Update system
    • Labels:
      None

      Description

      Currently there's no space between the index name and columns list when generating ADD INDEX sql query for MySQL DBMSes
      https://github.com/phpbb/phpbb/blob/develop/phpBB/phpbb/db/tools.php#L2178

      $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . '(' . implode(', ', $column) . ')';
      

      This may cause errors on earlier MySQL versions like 3.23 (which is supported by phpBB 3.1) like

      SQL ERROR [ mysql ]

      You have an error in your SQL syntax near 'user(user_id, notification_read)' at line 1 [1064]

      SQL

      ALTER TABLE phpbb3_notifications ADD INDEX user(user_id, notification_read)

      Adding a space solves the issue.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            nickvergessen Joas Schilling
            Reporter:
            rxu Ruslan Uzdenov
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development