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

Incorrect SQL in upgrade scripts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Administration
    • Labels:
      None
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      $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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              howardsmiller Howard Miller
              Tester:
              Nobody
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10