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

Error reading from database on multiple pages

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocker Blocker
    • None
    • 2.0.1
    • Database SQL/XMLDB
    • Windows Server 08 Standard, PHP 5.3.5, MS SQL server 2008 R2
    • Microsoft SQL
    • MOODLE_20_STABLE

      I have a new install of moodle 2.0.1 that we are testing. Most of it seems to be up and running just fine, however there are a few pages that keep giving me an error reading from database message. Pages with this error include... MY Courses\course name\participants, MY profile\Forum Posts\posts, and my profile\forum posts\discussions.

      The following debug info was taken from the participants page
      Debug info: SQLState: 42000<br>
      Error Code: 156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'FROM'.<br>
      SQLState: 42000<br>
      Error Code: 156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'FROM'.<br>
      SQLState: 42000<br>
      Error Code: 156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near the keyword 'AS'.<br>

      SELECT id, username, firstname, lastname, email, city, country, picture, lang, timezone, maildisplay, imagealt, COALESCE(ul.timeaccess, lastaccess, ctxid, ctxpath, ctxdepth, ctxlevel, ctxinstance FROM (SELECT TOP 9223372036854775806 ROW_NUMBER() OVER(ORDER BY lastaccess DESC) AS sqlsrvrownumber, id, username, firstname, lastname, email, city, country, picture, lang, timezone, maildisplay, imagealt, COALESCE(ul.timeaccess, lastaccess, ctxid, ctxpath, ctxdepth, ctxlevel, ctxinstance FROM (SELECT u.id, u.username, u.firstname, u.lastname,
      u.email, u.city, u.country, u.picture,
      u.lang, u.timezone, u.maildisplay, u.imagealt,
      COALESCE(ul.timeaccess, 0) AS lastaccess, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance FROM mdl_user u
      JOIN (SELECT DISTINCT eu1_u.id
      FROM mdl_user eu1_u
      JOIN mdl_user_enrolments eu1_ue ON eu1_ue.userid = eu1_u.id
      JOIN mdl_enrol eu1_e ON (eu1_e.id = eu1_ue.enrolid AND eu1_e.courseid = '3')
      WHERE eu1_u.deleted = 0 AND eu1_u.id <> '1') e ON e.id = u.id
      LEFT JOIN mdl_user_lastaccess ul ON (ul.userid = u.id AND ul.courseid = '3')
      LEFT JOIN mdl_context ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = 30) ) AS q) AS q WHERE q.sqlsrvrownumber > 0 AND q.sqlsrvrownumber <= 20
      [array (
      0 => '3',
      1 => '1',
      2 => '3',
      )]
      Stack trace:

      • line 391 of \lib\dml\moodle_database.php: dml_read_exception thrown
      • line 252 of \lib\dml\sqlsrv_native_moodle_database.php: call to moodle_database->query_end()
      • line 363 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->query_end()
      • line 761 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->do_query()
      • line 453 of \user\index.php: call to sqlsrv_native_moodle_database->get_recordset_sql()

      additionally the Functional DB tests page returns an error 500 internal server error page.

            moodle.com Moodle HQ
            fishermoodle Tim Gardiner
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.