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

Incorrect SQL in upgrade scripts

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0
    • 2.0
    • Administration
    • None
    • MOODLE_20_STABLE
    • 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

              timhunt Tim Hunt
              howardsmiller Howard Miller
              Nobody Nobody
              David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                24/Nov/10