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

Upgrade error on 4.5 if previously had older version of qtype_ordering

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not a bug
    • Icon: Minor Minor
    • None
    • 4.5.5
    • Questions
    • None
    • MOODLE_405_STABLE

      If you previously had qtype_ordering installed as a plugin, before 4.5 (e.g. I saw this error going from 4.3 -> 4.5), and then you upgrade your core codebase to rem,ove the plugin and have the core version of it which is now part of 4.5, you run into this upgrade error:

       

      -->qtype_ordering
      Default exception handler: Comparisons of text column conditions are not allowed. Please use sql_compare_text() in your query. Debug: 
      Error code: textconditionsnotallowed
      * line 689 of /lib/dml/moodle_database.php: dml_exception thrown
      * line 1923 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
      * line 323 of /question/type/ordering/db/upgrade.php: call to moodle_database->set_field()
      * line 758 of /lib/upgradelib.php: call to xmldb_qtype_ordering_upgrade()
      * line 1937 of /lib/upgradelib.php: call to upgrade_plugins()
      * line 274 of /admin/cli/upgrade.php: call to upgrade_noncore()
      !!! Comparisons of text column conditions are not allowed. Please use sql_compare_text() in your query. !!!
      !! 
      Error code: textconditionsnotallowed !!
      !! Stack trace: * line 689 of /lib/dml/moodle_database.php: dml_exception thrown
      * line 1923 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
      * line 323 of /question/type/ordering/db/upgrade.php: call to moodle_database->set_field()
      * line 758 of /lib/upgradelib.php: call to xmldb_qtype_ordering_upgrade()
      * line 1937 of /lib/upgradelib.php: call to upgrade_plugins()
      * line 274 of /admin/cli/upgrade.php: call to upgrade_noncore()
      

      This is caused by this line here:

      https://github.com/moodle/moodle/blob/MOODLE_405_STABLE/question/type/ordering/db/upgrade.php#L322

      And also this line here:

      https://github.com/moodle/moodle/blob/MOODLE_405_STABLE/question/type/ordering/db/upgrade.php#L362

      The issue being it is trying to do a WHERE clause on `value = 0`, but `value` is a TEXT field.

       

      It looks like for 5.0 this was fixed in this commit:

      https://github.com/mihailges/moodle/compare/7a318d5c85...MDL-84532-main

      "MDL-84532 qtype_ordering: Update query to use $DB->sql_compare_text() "

      But that was not applied to 4.5 or 4.4 in that tracker.

       

            Unassigned Unassigned
            cwarwicker CMR
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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