title: Postgres complains id 'already exists' after insert of initial data?
body: <p>I have an issue where Postgres is complaining of a duplicate ID following an import of some initial data and I am trying to see how to increment the id column counter?</p>
  
  <p>Details:</p>
  
  <p>I have recently uploaded some initial data into a Postgres table, where the id is set to autoincrement in my Sequelize model definition. For example:</p>
  
  <pre><code>    sequelize.define('user', {
          id: {
              type: Sequelize.INTEGER,
              primaryKey: true,
              autoIncrement: true
          },
          name: Sequelize.STRING
      }
  </code></pre>
  
  <p>The data insert looks like:</p>
  
  <pre><code>INSERT INTO "users" ("id","name") VALUES(1, "bob");
  INSERT INTO "users" ("id","name") VALUES(2, "brooke");
  INSERT INTO "users" ("id","name") VALUES(3, "nico");
  </code></pre>
  
  <p>Now from my node.js application when I try to insert a new record it complains that <code>Key (id)=(1) already exists</code>. The SQL Sequelize is using is of the form:</p>
  
  <pre><code>INSERT INTO "users" ("id","name") VALUES(DEFAULT, "nico");
  </code></pre>
  
  <p>If I am empty the table of records and try this again or retry the operations enough times, then I see the counter does increment. The issue seems Postgres is not able to tell what the current max id is, based on the records?</p>
  
  <p>What would be the right way to tell Postgres to update the counters, following uploading initial data into the database?</p>
  
  <p>BTW using Postgres 9.6</p>