title: Postgres: check array of text has elements castable to domain type in the where clause of a select statement
body: <p>Given I have defined domains with check constraints and I have the following query:</p>
  
  <pre><code>SELECT pm.name, ps.name, pm.id, ps.id 
  FROM 
      pylon_modules pm
      INNER JOIN 
      pylon_symbols ps ON pm.id = ps.module_id
  WHERE pm.name  in ('Test','test') and ps.name in ('bang');
  </code></pre>
  
  <p>What is the simplest way to cast the symbols used in the where clause ? I need to assert they match a domain type. </p>
  
  <p>Above 'Test' is not a valid module name.</p>
  
  <p>I can set up a stored procedure but the query is so simple I'd prefer to prepare it. </p>
  
  <p>If I use a stored procedure do I have to create an array version of my domain types ? </p>
  
  <p>There is <a href="http://www.postgresonline.com/journal/archives/228-PostgreSQL-Array-The-ANY-and-Contains-trick.html" rel="nofollow noreferrer">this</a>, but it requires the cast target is of array type. </p>