Moodle
  1. Moodle
  2. MDL-27634

mysql columns of type "double" not handled correctly in mysqli_native_moodle_database.php

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.3
    • Fix Version/s: STABLE backlog
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Environment:
      MySQL version 5.1.45
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Rank:
      17298

      Description

      Found that the following four columns are incorrectly identified as having inconsistent default values in the XMLDB editor:

      lesson_grades.grade
      scorm.maxgrade
      workshop_elements_old.stddev
      mdl_workshop_assessments_old.grade

      These also happen to be the only columns of type "double" in mysql. And, they are the only columns defined in the XMLDB XML as type "float" with no DECIMALS attribute set. (Try: find -name "install.xml" | xargs -i grep -H 'TYPE="float"' {})

      Things appear to go wrong in get_columns in lib/dml/mysqli_native_moodle_database.php at this line:

      } else if (preg_match('/(decimal|double|float)((\d+),(\d+))/i', $rawcolumn->type, $matches)) {

      which assumes that the double will include size information. In these cases, at least, it does not, and so the column info does not get the attributes populated.

      I don't know if this has cause problems in areas other than the XMLDB editor default values check.

        Activity

        Colin Campbell created issue -
        Michael de Raadt made changes -
        Field Original Value New Value
        Fix Version/s STABLE backlog [ 10463 ]
        Labels triaged
        Eloy Lafuente (stronk7) made changes -
        Assignee Eloy Lafuente (stronk7) [ stronk7 ]

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: