title: Change values before insert into table / PostgreSQL
body: <p>Ive got the following problem. I want to change some values of INSERT statement, e.g. there's a query:</p>
  
  <pre><code>INSERT INTO table(a,b) values(x,y);
  </code></pre>
  
  <p>But table has also another column <strong>c</strong>. I want to check (before INSERT) value of <strong>b</strong> from the query above and depending on one's value then set <strong>c=z</strong> but only for this specific row I've just inserted.</p>
  
  <p>I think that some trigger can help in my problem but I've no idea how to do that. Any pseudocode would be appreciated.</p>