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

Incorrect SQL in upgrade scripts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.0
    • 2.0
    • Administration
    • None
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE

      $version = 2010111002;

      in lib/db./upgrade.php at around line 5060

      // Update question_answers.
      // In question_answers.feedback was previously always treated as
      // FORMAT_HTML in calculated, multianswer, multichoice, numerical,
      // shortanswer and truefalse; and
      // FORMAT_MOODLE in essay (despite being edited using the HTML editor)
      // So essay feedback needs to be converted to HTML unless $CFG->texteditors == 'textarea'.
      // For all question types except multichoice,
      // question_answers.answer is FORMAT_PLAIN and does not need to be changed.
      // For multichoice, question_answers.answer is FORMAT_MOODLE, and should
      // stay that way, at least for now.
      $rs = $DB->get_recordset_sql('
      SELECT qa.*, q.qtype
      FROM

      {question_answers}

      qa
      JOIN

      {question}

      q ON a.question = q.id');

      The SQL has a syntax error - presumable it should have been 'ON qa.question' but there is certainly no table aliased to just 'a'. This causes an upgrade to 2.0 to fail.

            timhunt Tim Hunt
            howardsmiller Howard Miller
            Nobody Nobody (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

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