title: Set value of column based on another column in Postgres?
body: <p>I'm working with Postgres 9.1 and I have added a new boolean column to my table:</p>
  
  <pre><code>ALTER TABLE frontend_item ADD COLUMN is_generic BOOLEAN;
  </code></pre>
  
  <p>The value of this column will be based on the value of another column, <code>code</code>. If characters 10-11 of <code>code</code> are <code>AA</code> then the value of <code>is_generic</code> should be <code>TRUE</code>. Otherwise it should be false (or null if it hasn't been set yet). </p>
  
  <p>My question, is how can I do this in Postgres? I've been able to work out some individual components using the docs: </p>
  
  <pre><code> UPDATE frontend_item SET is_generic...
  </code></pre>
  
  <p>And then I know I can get the substring of <code>code</code> as follows:</p>
  
  <pre><code> substring(code from 10 for 2)
  </code></pre>
  
  <p>But how do I turn substring into a boolean, and then glue it together with the <code>UPDATE</code> statement?</p>