title: postgresql adjacency list query
body: <p>In postgresql, I have the following table</p>
  
  <pre><code>c_relation_investor_main_pfk; c_relation_investor_sub_pfk
  "inv_ho";"inv_ho_r"
  "inv_ho";"inv_ho_sf"
  "inv_priv";"inv_com"
  "inv_priv";"inv_encor"
  "inv_priv";"inv_ho"
  "inv_prof";"inv_b4"
  "inv_prof";"inv_com"
  "inv_prof";"inv_encor"
  "inv_prof";"inv_ho"
  "inv_prof";"inv_pd"
  "inv_prof";"inv_ut"
  </code></pre>
  
  <p>Given a child name, how can I list all the ascendants? And given a parent name, how can I list all of its descendants?</p>