From c40ff3464dc4eb293fff77d53c4c2b5068beedea Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 20 Apr 2008 21:20:45 +0000 Subject: [PATCH] Modify sql_concat() to support all elements being numeric. MDL-13823 ; backported from HEAD --- lib/dmllib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/dmllib.php b/lib/dmllib.php index f754f4dc2f3..abd66aed467 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -1666,9 +1666,14 @@ function sql_fullname($firstname='firstname', $lastname='lastname') { * @return string */ function sql_concat() { - global $db; + global $db, $CFG; $args = func_get_args(); +/// PostgreSQL requires at least one char element in the concat, let's add it +/// here (at the beginning of the array) until ADOdb fixes it + if ($CFG->dbfamily == 'postgres' && is_array($args)) { + array_unshift($args , "''"); + } return call_user_func_array(array($db, 'Concat'), $args); }