title: How to mimic a sequence in Postgres?
body: <p>In an application I have to generate numbers that can never be repeated, just like a sequence. So, each time a user asks for a number, the application has to return the last value generated plus one, <strong>never repeating a value</strong>.</p>
  
  <p>A sequence would work perfectly, except for the fact that each new day the generating seed has to be reset to 1 again. So, today the application starts generating numbers from 1 and no matter what is the last generated value, tomorrow it will generate values <strong>starting from 1 again</strong>.</p>
  
  <p>How to accomplish that?</p>