title: insert or update if exist postgres 9.4 with jdbc template
body: <p>I already know that PostgreSQL 9.5 and newer support <code>INSERT ... ON CONFLICT UPDATE</code>, i.e. upsert. Although, I can't afford to upgrade version I have. 
  So i try this in pgAdmin:</p>
  
  <pre><code>do $$
  begin 
  insert into test(id,description,name) values(10,'','road');
  exception when unique_violation then
  update function set name = 'newRoad',description='yes' where id =10;
  end $$;
  </code></pre>
  
  <p>It works but when I try to integrate this with jdbc template, I get : </p>
  
  <pre>
  java.lang.ArrayIndexOutOfBoundsException: null
  </pre>
  
  <p>by doing this:</p>
  
  <pre><code>sql.append("DO $$ BEGIN INSERT INTO test(id,description,NAME) VALUES(?,?,?)");
  sql.append(" exception when unique_violation then UPDATE SET description=?,");
  sql.append(" name=? where id=?");
  
  try {
      jdbcTemplate.update(sql.toString(), new Object[]{id,description,name,description,name,id});
  }
  </code></pre>
  
  <p>I don't know how to handle parameters with JDBC template request with 'exception when'.</p>