Home No operator matches the given name and argument type(s): What needs to be cast?
 I'm getting an error, and I cannot figure out why. I know the error is telling me to cast a type but I'm not sure on what? What part of CASE is the operator? ERROR: operator does not exist: character varying = boolean LINE 6: WHEN lower(foo.name) SIMILAR TO '%(foo ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.  My query: SELECT foo.name, bar.city, MAX(foo.total - bar.tax_amount), CASE bar.name WHEN lower(foo.name) SIMILAR TO '%(foo|bar|baz)%' THEN true ELSE false END .... GROUP BY foo.name, bar.city;