title: PostgreSQL, Getting column names from joined table
body: <p>I was manually specifying column names whenever I make some changes in my db query in my browser. Then, I wanted this procedure to be generic, so I decided to make a query for column names.</p>
  
  <p>So far I have read through some other threads, seems like following code works fine for plain tables without any joins.</p>
  
  <pre><code>select column_name
  from information_schema.columns
  where table_name='table_name';
  </code></pre>
  
  <p>However, I wanted to get a column names from inner joined table. Is there a way to achieve what I want?</p>
  
  <p>Here is a sample from my current project, I join three tables using inner join query.</p>
  
  <pre><code>select * 
  from analytic 
  inner join (select * from session_analytic 
      inner join  (select session_uid from title_session where title_uid = '1234')
      as n2 using(session_uid))
  as n3 using(analytic_uid);
  </code></pre>
  
  <p>as result of the query I get</p>
  
  <pre>
  --------------------------------------------------------------------------------
  |analytic_uid | total_playtime | total_frame | total_score | layer1_score |... |
  |-------------|----------------|-------------|-------------|--------------|----|
  |1            |         21.694 |         471 |           1 |           20 |... |
  |2            |          22.92 |         494 |           1 |            0 |... |
  |3            |          40.92 |         329 |           1 |            0 |... |
  |4            |         15.642 |         900 |           1 |            1 |... |
  |5            |        120.754 |        2400 |           0 |            0 |... |
  |6            |          5.878 |         323 |           1 |            0 |... |
  |7            |         26.177 |         614 |           0 |            0 |... |
  |8            |         21.959 |         517 |           1 |            0 |... |
  |9            |         10.759 |         227 |           1 |            0 |... |
  |10           |         35.458 |        2035 |           0 |            0 |... |
  --------------------------------------------------------------------------------
  </pre>
  
  <p>I want to retrieve column names with a query. So I can get something like this. Format doesn't really matter at the moment.</p>
  
  <blockquote>
    <p>[analytic_uid, total_playtime, total_frame, total_score, layer1_score, ...] </p>
  </blockquote>