title: How to UPSERT multiple rows with individual values in one statement?
body: <p>I've created the following table:</p>
  <pre><code>CREATE TABLE t1(
  a   INT UNIQUE, 
  b   varchar(100) NOT NULL,
  c   INT, 
  d   INT DEFAULT 0,  
  PRIMARY KEY (a,b));
  </code></pre>
  <p>On a single row this SQL statement works great (the SQL is generated in code):</p>
  <pre><code>INSERT INTO t1 (a, b, c, d)
  VALUES($params.1, '${params.2}', $params.3, params.4) 
  ON CONFLICT (a,b) DO 
  UPDATE SET d=params.4
  </code></pre>
  <p>Is it possible to upsert multiple rows at once? For each update the value of <code>params.4</code> is different.</p>
  <pre><code>var sqlStr = 'INSERT INTO t1 (a, b, c, d) VALUES '
  for(let i =0 i &lt; params.length; i++){
     sqlStr += `(${params[i].1}, '${params[i].2}', ${params[i].3}, ${params[i].4}),`
     
  }
  sqlStr = sqlStr.substring(0, sqlStr .length - 2) +')';
  sqlStr += 'ON CONFLICT (a,b) DO UPDATE SET **d=???**' &lt;-- this is the problem
  </code></pre>
  <p><code>params[i].4</code> has different value for each row and the <code>ON CONFLICT</code> statement appears only once (not per row) and <code>SET</code> doesn't support a <code>WHERE</code>.</p>
  <p>Example, if my table has the following rows:</p>
  <pre><code> a | b | c | d 
  ---+---+---+---
   1 | 1 | 1 | 1
   2 | 2 | 2 | 2
  </code></pre>
  <p>And my new input is <code>[(1,'1',1,11),(2,'2',2,22),(3,'3',3,3)]</code>.<br />
  There are two conflicts - <code>(1,1)</code> and <code>(2,2)</code>. The result should be:</p>
  <pre><code> a | b | c | d 
  ---+---+---+---
   1 | 1 | 1 | 11
   2 | 2 | 2 | 22
   3 | 3 | 3 | 3
  </code></pre>