title: Postgresql: Creating a Trigger
body: <p>I have to create a trigger in postgresql (without any function calls). I have two tables LivesIn(pid, name, province) and Places(name, province, population, mayorid)</p>
  
  <p>I have the following code:</p>
  
  <pre><code>CREATE TRIGGER updatePopulation
  AFTER INSERT ON LivesIn
  FOR EACH ROW  
  UPDATE Places
  SET NEW.population = OLD.Population + 1
  WHERE LivesIn.name = Places.name AND LiveIn.province = Places.province;
  </code></pre>
  
  <p>I am getting the following error:
      psql:/home/2008/uehtes/Desktop/Comp421/comp421_a2_q1.sql:111: ERROR:  syntax error at or near "UPDATE"
      LINE 5:  UPDATE Places.population
           ^</p>
  
  <p>Any help would be really appreciated. </p>