title: How to UNION a list of tables retrieved from another table with a single query?
body: <p>I have a table with a list of tables in PostgreSQL:</p>
  
  <pre><code>|id|table |
  |--|------|
  |1 |table1|
  |2 |table2|
  |3 |table3|
  </code></pre>
  
  <p>I want to select from a union of all these tables like (pseudo-code):</p>
  
  <pre><code>select * from union(select table from tablenames)
  </code></pre>