FIX postgres can filter on non text fields

Filtering non text fields in postgres would cause the SQL to fail. This
casts the field to text before the LIKE filter.
Merge pull request #2242 from torleif/3.0

FIX postgres can filter on non text fields