title: Make MERGE on PostgreSQL 9.5
body: <p>I'm trying to do a MERGE in PostgreSQL 9.5 and I get the following error:</p>
  
  <pre><code>ERROR:  syntax error at or near "MERGE"
  LINE 1: MERGE INTO TP_ESTADO_EQUIPOS AS EQ
          ^
  
  ********** Error **********
  
  ERROR: syntax error at or near "MERGE"
  SQL state: 42601
  Character: 1
  </code></pre>
  
  <p><strong>SQL</strong></p>
  
  <pre><code>MERGE INTO TP_ESTADO_EQUIPOS AS EQ
  USING (SELECT * FROM TEMP_TABLE_STATE_EQUIPMENT) AS VEQ
  ON EQ.ESTADO_EQUIPOS_ID = VEQ.ESTADO_EQUIPO_ID
   WHEN MATCHED THEN (
   EQ.TIEMPO_INICIO=VEQ.TIEMPO_INICIO,
   EQ.TIEMPO_FIN=VEQ.TIEMPO_FIN,
   ...
   )
  WHEN NOT MATCHED THEN
  INSERT(Estado_Equipos_ID,
          Tiempo_Inicio,
          ...
          )
          VALUES(VEQ.ESTADO_EQUIPO_ID,
                  VEQ.Tiempo_Inicio,
                  ...);
  </code></pre>
  
  <p>I have been reading documentation, and I may have to use <code>UPSERT</code>, but it is still not clear to me if that is necessarily the error.</p>