title: field values as columns from master detail in PostgreSQL
body: <p>i got two tables in a master-detail relation and want to select all data in a single select query.</p>
  
  <p>table "person":</p>
  
  <pre><code>id;name
  1;Allen
  2;Bert
  3;Chris
  </code></pre>
  
  <p>table "connectivity":</p>
  
  <pre><code>id;personId;type;value
  1;1;phone;+123456789
  2;1;mail;allen@allen.allen
  3;2;mail;bert@bert.bert
  4;3;phone;+987654321
  5;3;fax;+987654322
  </code></pre>
  
  <p>The query output should be something like</p>
  
  <pre><code>person.id;person.name;phone;mail;fax
  1;Allen;+123456789;allen@allen.allen;
  2;Bert;;bert@bert.com;
  3;Chris;+987654321;;+987654322
  </code></pre>
  
  <p>Any idea possibly without writing some function?
  It should dynamically add the colummns when the detail-table is extended. E.g. adding a row to the detail table like</p>
  
  <pre><code>6;2;icq;0123456789
  </code></pre>
  
  <p>My prefered solution would fit into a select-query.</p>
  
  <p>Thanks!
  Patrick</p>