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

Course search broken on Oracle

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.5, 2.1.2, 2.2
    • 2.0.6, 2.1.3
    • Course
    • None
    • RHEL6, Oracle 11g
    • Oracle
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • 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

    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.

      Attachments

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              jonof Jonathon Fowler
              Sam Hemelryk Sam Hemelryk
              Rossiani Wijaya Rossiani Wijaya
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                28/Nov/11