title: Rename column only if exists
body: <p>PostgreSQL does not allow </p>
  
  <pre><code>ALTER TABLE t RENAME COLUMN IF EXISTS c1 TO c2
  </code></pre>
  
  <p>...or anything like that.  However, it's very convenient to be able to write scripts which modify DB structure which can be run again without first checking if it has already been run.</p>
  
  <p>How do I write a PostgreSQL function to do exactly this?</p>