title: Postgresql upsert with JDBC parameter markers
body: <p>I've got an INSERT statement that works today when called from JDBC using parameters markers:</p>
  
  <pre><code>INSERT INTO errorqueue as eq (jobname, sourceid, item) VALUES(?,?,?)
  </code></pre>
  
  <p>In my Java code, I bind the parameters:</p>
  
  <pre><code>Connection connection=null;
  PreparedStatement stmt=null;
  try {
  
      connection = getConnection();
      stmt = connection.prepareStatement(sqlInsert);
  
      stmt.setString(1, this.jobName);
      stmt.setString(2, errorItem.getId());
      stmt.setString(3, item.getBody());
      stmt.executeUpdate();
  } catch () {
  ...
  }
  </code></pre>
  
  <p>I'm struggling with how I'd need to handle the parameters if I convert this to an UPSERT:</p>
  
  <pre><code>INSERT INTO errorqueue as eq (jobname, sourceid, item) VALUES(?,?,?) ON CONFLICT (jobname,sourceid) UPDATE eq SET item=? Where jobname=? and sourceid=?;
  </code></pre>
  
  <p>It's sneaky subtle, but in the INSERT the parameter order is (a,b,c) but in the update, the paramter binding needs to be (c,a,b)</p>