title: Auto Increment in Postgres from Dropwizard Application
body: <p>I am connecting my dropwizard application with the Postgres db. I am creating tables dynamically at the time of starting the application server.</p>
  
  <pre><code>private static void createTableUser(Connection connection) throws SQLException {
      Statement statement= connection.createStatement();
      statement.executeUpdate("CREATE TABLE USERR"
              +"("+
              "id INTEGER,"+
              "first_name VARCHAR(20),"+
              "middle_name VARCHAR(20),"+
              "last_name VARCHAR(20),"+
              "age INTEGER,"+
              "image_url VARCHAR(250),"+
              "joining_date DATE ,"+
              "country_code INTEGER,"+
              "mobile_no VARCHAR(20),"+
              "email_id VARCHAR(20),"+
              "CONSTRAINT pk_user PRIMARY KEY (id)"+
              ")"
      );
      statement.close();
  }
  </code></pre>
  
  <p>Above is the function creating my table. This way it is working very well. But I want to make <code>id</code> as auto increment. I went through articles which gave suggestion of keyword <code>"SERIAL", "BIGSERIAL", "SMALLSERIAL"</code>.</p>
  
  <p>When I was using sql server I was doing it the way </p>
  
  <pre><code>id INTEGER IDENTITY (1)
  </code></pre>
  
  <p>and here also <code>IDENTITY</code> is available as option but when I tried it I was getting error</p>
  
  <pre><code>Exception in thread "main" org.postgresql.util.PSQLException: ERROR: syntax error at or near "IDENTITY"
  </code></pre>
  
  <p>Can anyone help me?
  Thanks in advance</p>