title: How can I update a table based on a plpgsql instruction loop on PostgreSQL 8.3.16?
body: <p>I got a problem I not sure how to solve it so far...</p>
  
  <p>I have two tables that are related to each other with a 1 x n relation. I will try to describe the more importants fields below:</p>
  
  <p>Table One - company:id PK,companyname varchar;<br>
  Table Two - training: course varchar,companyid bigint FK,id PK;</p>
  
  <p>The problem is: I would like to update the information on course field of the table training because there are many courses with the same name. My idea is use something like </p>
  
  <pre><code>for s in 1..n loop 
  update training set course = course || s;
  end loop;
  </code></pre>