title: PostgreSQL reset id for every new year or increment for same year
body: <p>I have a table like</p>
  
  <pre><code>id  name  xxx yyy receipt_id receipt_year
  1   abcd  x   a   1          2018
  2   abc   y   b   2          2018
  3   abd   z   c   3          2018
  4   abe   z   d   4          2018
  </code></pre>
  
  <p>id column is bigserial (big int with auto increment) and i am increasing receipt_id manually. I want to reset receipt_id every year i.e start with 1 for every new year. How can i do this in a better way ?</p>