title: multiple insert with sequence fails in Postgres
body: <p>There is one insert query with multiple values (about 18k):</p>
  
  <pre><code>INSERT INTO ENTRIES (ID, USER_ID) 
  VALUES (nextval('my_seq'), '233'),(nextval('my_seq'), '233');
  </code></pre>
  
  <p>Which is fired from liquibase changeset in java application:</p>
  
  <pre><code>JdbcConnection connection = (JdbcConnection) database.getConnection();
  
          ResultSet resultSet = connection.prepareStatement("SELECT ID FROM USERS").executeQuery();
  
          List&lt;String&gt; values = new ArrayList&lt;&gt;();
  
          while (resultSet.next()) {
              Long userId = resultSet.getLong(1);
  
              for (int i = 0; i &lt; 3; i++) {
                  values.add("(nextval('my_seq'), '" + userId + "')");
              }
          }
  
          String sql = "INSERT INTO ENTRIES (ID, USER_ID) VALUES " + join(values, ",") + ";";
  
          connection.createStatement().execute(sql);
  </code></pre>
  
  <p>When it is executed against h2 database, everything is fine, but when I am running that against postgres the following exception is being thrown:</p>
  
  <pre><code>duplicate key value violates unique constraint "entries_pkey"
  </code></pre>
  
  <p>Like id from sequance is being reused.</p>
  
  <p>When running sql in pgAdmin everything is ok, but from application it fails on the first insert.</p>
  
  <p>My first thought is that maybe sql should be executed somehow differently.</p>
  
  <p>Any thoughts on this?</p>
  
  <p>Here is table description:</p>
  
  <pre><code>  CREATE TABLE entries
  (
    id bigint NOT NULL,
    user_id bigint,
    CONSTRAINT entries_pkey PRIMARY KEY (id),
    CONSTRAINT fk_e3udjwux3ly7lu31huish0f82 FOREIGN KEY (user_id)
        REFERENCES users (id) MATCH SIMPLE
        ON UPDATE NO ACTION ON DELETE NO ACTION
  )
  WITH (
    OIDS=FALSE
  );
  ALTER TABLE entries
    OWNER TO app;
  </code></pre>