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

"Error reading from database" when deleting Course Categories under Site administration / Courses / Add/edit courses

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.0.3
    • 2.0.2
    • Course
    • Microsoft SQL
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

      1. On the Moodle Front Page click Courses under Site Administration. The Courses sub-menu is displayed.
      2. Click Add/Edit Courses.
      3. Moodle displays the Course Categories screen: /course/index.php?categoryedit=on

      If you click the DELETE icon in the Edit column of any of the Course Categories that are displayed on the table Moodle throws a "Error reading from database" error:

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

      SELECT q.* FROM (SELECT TOP 9223372036854775806 ROW_NUMBER() OVER(ORDER BY id) AS sqlsrvrownumber, q.* FROM (SELECT *
      FROM mdl_question q
      JOIN mdl_question_categories qc ON qc.id = q.category
      WHERE qc.contextid = '27202' AND q.parent = 0) AS q) AS q WHERE q.sqlsrvrownumber > 0 AND q.sqlsrvrownumber <= 1
      [array (
      0 => '27202',
      )]
      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 1553 of \lib\dml\moodle_database.php: call to sqlsrv_native_moodle_database->get_recordset_sql()
      • line 396 of \lib\questionlib.php: call to moodle_database->record_exists_sql()
      • line 55 of \course\delete_category_form.php: call to question_context_has_any_questions()
      • line 152 of \lib\formslib.php: call to delete_category_form->definition()
      • line 130 of \course\index.php: call to moodleform->moodleform()

      If you click the Continue button below this error you are redirected to the Moodle Front Page.

        1. screenshot-1.jpg
          116 kB
          Luis de Vasconcelos

            stronk7 Eloy Lafuente (stronk7)
            libertymoodle Luis de Vasconcelos
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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