title: Using UPCASE or Regexp in Array Column on Postgres
body: <p>I am trying to query a Postgres Array Column disregarding case and perhaps even disregarding spaces as well.</p>
  
  <pre><code>SELECT "cats".* FROM "cats" WHERE ('CATS - PERSA' = ANY(UPCASE(cat_types))) ORDER BY "cats"."id" ASC LIMIT 1;
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>You might need to add explicit type casts.
  </code></pre>
  
  <p>AS a bonus I would like to also be able to do a regexp where the search ignores spaces in values on the cat_types column.</p>
  
  <p>I am using Ruby on Rails to do this.</p>
  
  <pre><code>cat_type.upcase.delete(' ')
  Cats.where("'#{cat_type}' = ANY(cat_types)").first 
  </code></pre>
  
  <p>The query works just using ANY but I want to be able to disregard spaces and upcase the values in cat_types so that it has more chances of matching. Ilike could also be a possibility.</p>
  
  <p>Thanks.</p>