Moodle

Serious problem upgrading Quiz tables on MYSQL using a SUB SELECT

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: 1.9
  • Component/s: Questions, Quiz
  • Labels:
    None
  • Environment:
    MySQL 5.0.22, PHP 5.1.6
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

The change is here:

http://moodle.cvs.sourceforge.net/moodle/moodle/mod/quiz/db/upgrade.php?r1=1.1&r2=1.2

SQL for MySQL is:

DELETE FROM mdl_question_numerical_units WHERE id > (SELECT MIN(iqnu.id) FROM mdl_question_numerical_units iqnu WHERE iqnu.question = mdl_question_numerical_units.question AND iqnu.unit = mdl_question_numerical_units.unit)

The query fails completely with errors:

1093: You can't specify target table 'mdl_question_numerical_units' for update in FROM clause

Also, should this upgrade be in the quiz/db? I would have thought question/type/numerical/db ...

Activity

Hide
Tim Hunt added a comment -

For historical reasons, the table mdl_question_numerical_units is defined in quiz/db. This needs to be cleaned up one day, but not now. So as long at the table is defined there, I'm going to leave the corresponding upgrade code there. (This table is shared by numerical and calculated, which is why it was not put under one of them.)

I would test on my MySQL install, but upgrading from 2006101001 fails.

Show
Tim Hunt added a comment - For historical reasons, the table mdl_question_numerical_units is defined in quiz/db. This needs to be cleaned up one day, but not now. So as long at the table is defined there, I'm going to leave the corresponding upgrade code there. (This table is shared by numerical and calculated, which is why it was not put under one of them.) I would test on my MySQL install, but upgrading from 2006101001 fails.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: