The change is here:
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 ...