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

dmlreadexception when installing on MSSQL without table prefix

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5.4, 2.6.1, 2.7
    • Fix Version/s: 2.5.5, 2.6.2
    • Component/s: Installation
    • Labels:
    • Testing Instructions:
      Hide

      1) Use a default config.php file, using the sqlsrv driver, and set $CFG->prefix to '' (empty string).

      2) Try to access to any Moodle page with the settings above, an immediate error should be shown: "Error: database table prefix cannot be empty (mssql)" not allowing the application to go anywhere beyond that.

      3) Set a non empty $CFG->prefix value and visit the site again. Now it will work with normality (installation will be triggered if the site is new or normal pages will work if the site already existed).

      4) Run unit tests for sqlsrv, no problems should appear related with this issue.

      Show
      1) Use a default config.php file, using the sqlsrv driver, and set $CFG->prefix to '' (empty string). 2) Try to access to any Moodle page with the settings above, an immediate error should be shown: "Error: database table prefix cannot be empty (mssql)" not allowing the application to go anywhere beyond that. 3) Set a non empty $CFG->prefix value and visit the site again. Now it will work with normality (installation will be triggered if the site is new or normal pages will work if the site already existed). 4) Run unit tests for sqlsrv, no problems should appear related with this issue.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Pull Master Branch:

      Description

      The following exception occurs when using the web installer, configured with MSSQL without a table prefix. I believe the issue is because "User" is a reserved word in MSSQL and must be escaped (if that is the proper way to say it) using square brackets: [User].

      Message: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'user'.<br>
      
      SELECT TOP 1 'x' FROM user 
      [array (
      )] 
      Error code: dmlreadexception
      

      I was able to work around this by: dumping the database, updating the config.php file to include a table prefix, and re-installing.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Mar/14