title: Upsert if on conflict occurs on multiple columns in Postgres db
body: <p>I have a table in Postgres db with no primary keys. I want to update if the combination of 2 columns have the same value.</p>
  
  <pre><code>...
  ON CONFLICT (col1, col2)
  DO UPDATE
  
  ELSE 
  INSERT
  ...
  </code></pre>
  
  <p>I couldn't find anything without primary keys. Also, the combination of col1 and col2 is unique. There could be multiple rows for col1 with the same value or with col2 but together cannot. </p>
  
  <p>So my table is something like this: </p>
  
  <pre><code>col1  col2
  1     A    
  1     B
  2     A
  2     B
  </code></pre>
  
  <p>I cannot have a unique constraint on either of these columns but adding the index together in a combination works as follows:</p>
  
  <pre><code>CREATE TABLE example (
  col1 integer,
  col2 integer,
  col3 integer,
  UNIQUE (col1, col3));
  </code></pre>
  
  <p>But now, how to handle the inserts. What should be the <code>ON CONFLICT</code> condition as we cannot have on 2 columns so back to the same issue.</p>