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

Course search broken on Oracle

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5, 2.1.2, 2.2
    • Fix Version/s: 2.0.6, 2.1.3
    • Component/s: Course
    • Labels:
      None
    • Environment:
      RHEL6, Oracle 11g
    • Database:
      Oracle
    • Testing Instructions:
      Hide

      Using the 4DBs:

      • use the course search facility
      • check no SQL error is thrown and the facility works ok, returning matching courses
      Show
      Using the 4DBs: use the course search facility check no SQL error is thrown and the facility works ok, returning matching courses
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Following the fix for MDL-29496, searching for courses fails under the Oracle database with this error: ORA-00932: inconsistent datatypes: expected CLOB got CHAR

      The problem is the COALESCE(c.summary, ' ') in lib/datalib.php (around line 720) which mixes CLOB and CHAR. A solution is this:

      -    $concat = $DB->sql_concat("COALESCE(c.summary, '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
      +    $concat = $DB->sql_concat("COALESCE(". $DB->sql_compare_text("c.summary", 2000) .", '". $DB->sql_empty() ."')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');

      The 2000 parameter is because by default $DB->sql_compare_text() takes only the first 32 characters of c.summary, which is not very many, but this only affects databases for which $DB->sql_compare_text() isn't a no-op.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    28/Nov/11