-
Bug
-
Resolution: Fixed
-
Minor
-
2.0.5, 2.1, 2.2
-
Debian Squeeze, Postgres 9.0, Apache2
-
PostgreSQL
-
MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_20_STABLE, MOODLE_21_STABLE
-
wip-
MDL-29496-master -
-
If courses have been created by an enrolment plugin which doesn't provide any summary, then the summary field is set to null.
Under Postgres (and probably other DBs) when the fullname and summary are concatenated, the presence of the NULL summary field means that the resulting concatenation is also null.
E.g.:
If summary = 'foo', and fullname = 'bar', then summary || ' ' || fullname = 'foo bar'
If summary IS NULL, and fullname = 'bar', then summary || ' ' || fulname = NULL
As a result, the search fails to match on valid fullname matches.
I'm unsure as to how compatible COALESCE is, but under Postgres, COALESCEing the summary, and an empty string ensures that we can search if the summary is NULL.
For example:
$concat = $DB->sql_concat('c.summary', "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
|
becomes:
$concat = $DB->sql_concat("COALESCE(c.summary, '')", "' '", 'c.fullname', "' '", 'c.idnumber', "' '", 'c.shortname');
|