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

Incorrect CASE statement breaking under mssql, sqlsrv and oracle drivers

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0
    • Component/s: Forum, Unit tests
    • Labels:
    • Testing Instructions:
      Hide

      1) Repeat testing instructions from MDL-50993 against all DBs.
      2) Run unit tests against all DBs, vendor/bin/phpunit mod_forum_lib_testcase mod/forum/tests/lib_test.php should be enough, that's the broken & fixed stuff.

      Show
      1) Repeat testing instructions from MDL-50993 against all DBs. 2) Run unit tests against all DBs, vendor/bin/phpunit mod_forum_lib_testcase mod/forum/tests/lib_test.php should be enough, that's the broken & fixed stuff.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      It was detected that one of the CASE statements introduced by MDL-50993 was breaking under oracle, mssql and sqlsrv (link).

      CASE statements cannot be used to build partial/alternative SQL conditions, just to return a value that later (out from the statement) can be evaluated as desired. (link).

      So, here there is a patch that makes unit tests to pass under all databases (link).

      Updated: Mystery was solved, my fault, read comments below. Note that it's really mysterious how unit tests have been passing everywhere (nightly, runs here filling the release testing matrix...) when the query should not have passed ever. If anybody has time to investigate the mystery, great. I have not.

      Ciao

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Peer reviewer:
              Tim Hunt Tim Hunt
              Integrator:
              Andrew Lyons Andrew Lyons
              Tester:
              Rajesh Taneja Rajesh Taneja
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                16/Nov/15