title: postgresql nextval generating existing values
body: <p>I had to migrate from a mySql based ruby on rails app to using postgresql. No problems but one so far, and I don't know how to solve it. </p>
  
  <p>The migration of data brought ids along with it, and postgresql is now having problems with existing ids: it's not clear to me where it gets the value that it uses to determine the base for nextval: it certainly isn't the highest value in the column, although you might think that would be a good idea. In any case, it's now colliding with existing id values. id column, created from a standard RoR migration is defined as</p>
  
  <pre><code>not null default nextval('geopoints_id_seq'::regclass)
  </code></pre>
  
  <p>Is there some place that the value it uses as a base can be hacked? This problem could now arise in any of 20 or so tables: I could use </p>
  
  <pre><code>'select max(id) from &lt;table_name&gt;' 
  </code></pre>
  
  <p>but that seems to make the idea of an autoincrement column pointless.</p>
  
  <p>How is this best handled?</p>