title: Postgresql, update if row with some unique value exists, else insert
body: <p>I have a URLs table. They contain </p>
  
  <p>(id int primary key,
   url character varying unique, 
  content character varying, 
  last analyzed date). </p>
  
  <p>I want to create trigger or something(rule may be), so each time i make insert from my java program, it updates some single row if row with such URL exists. Else it should perform an Insert.</p>
  
  <p>Please, can you provide a complete code in Postgresql. Thanks.</p>