title: Advance sequence (`nextval`) in PostgreSQL if a row is inserted
body: <p>I'm conditionally inserting a row into the a PostgreSQL table and manually specifying the ID:</p>
  <pre><code>INSERT INTO foo (foo_id, foo_name)
  SELECT 4, 'My Name'
  WHERE NOT EXISTS (
      SELECT * FROM foo WHERE foo_id = 4
  );
  </code></pre>
  <p>This won't increase the sequence that generates the next <code>foo_id</code>.</p>
  <p>How can I run <code>SELECT nextval('foo_foo_id_seq'::regclass);</code> only if a row is actually inserted in the above query?</p>