From 7626d74beebe28bc48440f75195a1a14330c8cc3 Mon Sep 17 00:00:00 2001 From: torleif Date: Tue, 8 Apr 2014 13:24:05 +1200 Subject: [PATCH] FIX postgres can filter on non text fields This issue causes the comparison to fail if comparing a non text fields (for example, a date or integer). This will cause the CMS to fail in places such as Gridfield selector. Similar fix as this one: https://github.com/silverstripe/silverstripe-framework/pull/2242 The difference being comparisonClause(...) being more apt solution in SS 3.1 --- code/PostgreSQLDatabase.php | 1 + 1 file changed, 1 insertion(+) diff --git a/code/PostgreSQLDatabase.php b/code/PostgreSQLDatabase.php index 2a9dc08..329a032 100644 --- a/code/PostgreSQLDatabase.php +++ b/code/PostgreSQLDatabase.php @@ -2108,6 +2108,7 @@ class PostgreSQLDatabase extends SS_Database { } else { $comp = ($caseSensitive === true) ? 'LIKE' : 'ILIKE'; if($negate) $comp = 'NOT ' . $comp; + $field.='::text'; } return sprintf("%s %s '%s'", $field, $comp, $value);