title: PostgreSQL row to columns
body: <p>I'm trying to create a dynamic system that allows the users to import lists of data from Excel so I need to have dynamic columns, ex:</p>
  
  <pre><code>custom_columns_table
  id   list_id  data_type       column_name  data              ....
  1    1        VARCHAR(255)    email        jhon@example.com  ....
  2    1        VARCHAR(255)    name         Jhon              ....
  
  list_table
  id
  1
  </code></pre>
  
  <p>I need a result like this:</p>
  
  <pre><code>id email             name  ....
  1  jhon@example.com  Jhon  ....
  </code></pre>
  
  <p>I have found some examples using crosstab but I don`t know if it will work in this case.</p>
  
  <p>Does anyone know how can I do this?</p>