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

Enabling Site News on Front Page causes an "error reading from database" message

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 2.0.1
    • Database SQL/XMLDB
    • None
    • WIN64, IIS7, MS SQL
    • Microsoft SQL
    • MOODLE_20_STABLE

      When enabling site news on the front page, an 'Error reading from database' message is displayed.

      Steps to reproduce:

      • Log in to the Moodle site as administrator
      • Navigate to Settings->Site Administration->Front Page->Front Page Settings
      • From the 'Front Page' drop down lists, select 'Site News' and save

      Expected: a list of site news items

      Got: an 'Error reading from database' message

      Debug info is as follows:

      Debug info: SQLState: 42000<br>
      Error Code: 8156<br>
      Message: [Microsoft][SQL Server Native Client 10.0][SQL Server]The column 'name' was specified multiple times for 'q'.<br>

      SELECT , name, timemodified, usermodified, groupid, timestart, timeend, firstname, lastname, email, picture, imagealt FROM (SELECT TOP 9223372036854775806 ROW_NUMBER() OVER(ORDER BY modified DESC) AS sqlsrvrownumber, *, name, timemodified, usermodified, groupid, timestart, timeend, firstname, lastname, email, picture, imagealt FROM (SELECT p., d.name, d.timemodified, d.usermodified, d.groupid, d.timestart, d.timeend,
      u.firstname, u.lastname, u.email, u.picture, u.imagealt
      FROM mdl_forum_discussions d
      JOIN mdl_forum_posts p ON p.discussion = d.id
      JOIN mdl_user u ON p.userid = u.id

      WHERE d.forum = '4' AND p.parent = 0

      ) AS q) AS q WHERE q.sqlsrvrownumber > 0 AND q.sqlsrvrownumber <= 3
      [array (
      0 => '4',
      )]
      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 905 of \lib\dml\sqlsrv_native_moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql()
      • line 2596 of \mod\forum\lib.php: call to sqlsrv_native_moodle_database->get_records_sql()
      • line 5084 of \mod\forum\lib.php: call to forum_get_discussions()
      • line 175 of \index.php: call to forum_print_latest_discussions()

            msketcham Michael Ketcham (Inactive)
            adaml Adam Landow (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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