Moodle
  1. Moodle
  2. MDL-30352

Error sorting assignment submissions by comment (in Oracle)

    Details

    • Database:
      Oracle
    • Testing Instructions:
      Hide

      Sorting assignment submissions by comment shouldn't give any error

      Show
      Sorting assignment submissions by comment shouldn't give any error
    • Workaround:
      Hide

      As far as clob datatype isn't allowed in an order by sentence, I suppose that those datatype columns should be casted in allowed datatypes somehow.

      Show
      As far as clob datatype isn't allowed in an order by sentence, I suppose that those datatype columns should be casted in allowed datatypes somehow.
    • Affected Branches:
      MOODLE_21_STABLE
    • Rank:
      32735

      Description

      When sorting the assignment submissions by comment it crashes with ORA-00932 inconsistent datatypes: expected - got clob

      * line 394 of \lib\dml\moodle_database.php: dml_read_exception thrown
      * line 268 of \lib\dml\oci_native_moodle_database.php: call to moodle_database->query_end()
      * line 1093 of \lib\dml\oci_native_moodle_database.php: call to oci_native_moodle_database->query_end()
      * line 1325 of \mod\assignment\lib.php: call to oci_native_moodle_database->get_records_sql()
      * line 649 of \mod\assignment\lib.php: call to assignment_base->display_submissions()
      * line 369 of \mod\assignment\type\upload\assignment.class.php: call to assignment_base->submissions()
      * line 57 of \mod\assignment\submissions.php: call to assignment_upload->submissions()
      

      This is because the comment column (mdl_assignment_submissions.submissioncomment) datatype is CLOB, and that's because (at least in Oracle) that kind of columns aren't allowed in the order by sentence

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting that and suggesting a solution.

          We should create a new issue type: "Oracle/Postgres order by"

          Show
          Michael de Raadt added a comment - Thanks for reporting that and suggesting a solution. We should create a new issue type: "Oracle/Postgres order by"
          Hide
          Michael de Raadt added a comment -

          Looks like this issue is a duplicate. It would be worth considering of the proposed solution in the linked issue would suit Oracle (as it was proposed with Postgres).

          Show
          Michael de Raadt added a comment - Looks like this issue is a duplicate. It would be worth considering of the proposed solution in the linked issue would suit Oracle (as it was proposed with Postgres).
          Hide
          Iñigo Zendegi added a comment -

          Hello Michael,

          I think this isn't the same issue as the MDL-29937, as far as the symptoms aren't the same (on that case it just don't sort results as expected and in this case it crashes with a database error).

          Even if on both issues the problem is in the order by clause, here the problem is because the column datatype used in Oracle (clob) is not allowed in the order by sentence, and that makes the database throw an ORA-00932, and in MDL-29937 the problem is a not expected sort when the column has null values.

          Even so, I tried so apply the solution provided on the MDL-29937 (just in case), but it didn't work.

          Therefore, I suggest to reconsider it and treat this as a different issue

          Show
          Iñigo Zendegi added a comment - Hello Michael, I think this isn't the same issue as the MDL-29937 , as far as the symptoms aren't the same (on that case it just don't sort results as expected and in this case it crashes with a database error). Even if on both issues the problem is in the order by clause, here the problem is because the column datatype used in Oracle (clob) is not allowed in the order by sentence, and that makes the database throw an ORA-00932, and in MDL-29937 the problem is a not expected sort when the column has null values. Even so, I tried so apply the solution provided on the MDL-29937 (just in case), but it didn't work. Therefore, I suggest to reconsider it and treat this as a different issue

            People

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

              Dates

              • Created:
                Updated:
                Resolved: