title: Postgres: check if array field contains value?
body: <p>I'm sure this is a duplicate question in the sense that the answer is out there somewhere, but I haven't been able to find the answer after Googling for 10 minutes, so I'd appeal to the editors not to close it on the basis that it might well be useful for other people. </p>
  
  <p>I'm using Postgres 9.5. This is my table:</p>
  
  <pre><code>        Column          │           Type            │                                Modifiers
  ─────────────────────────┼───────────────────────────┼─────────────────────────────────────────────────────────────────────────
   id                      │ integer                   │ not null default nextval('mytable_id_seq'::regclass)
   pmid                    │ character varying(200)    │
   pub_types               │ character varying(2000)[] │ not null
  </code></pre>
  
  <p>I want to find all the rows with "Journal" in <code>pub_types</code>.</p>
  
  <p>I've found the docs and googled and this is what I've tried:</p>
  
  <pre><code>select * from mytable where ("Journal") IN pub_types;
  select * from mytable where "Journal" IN pub_types;
  select * from mytable where pub_types=ANY("Journal");
  select * from mytable where pub_types IN ("Journal");
  select * from mytable where where pub_types contains "Journal";
  </code></pre>
  
  <p>I've scanned <a href="https://www.postgresql.org/docs/9.1/static/arrays.html" rel="noreferrer">the postgres array docs</a> but can't see a simple example of how to run a query, and StackOverflow questions all seem to be based around more complicated examples. </p>