title: Is it possible to JOIN with a CTE in PostgreSQL?
body: <p>I'm trying to write a query like this</p>
  
  <pre><code>WITH a AS (SELECT key FROM table) 
  SELECT * 
  FROM a 
    JOIN b;
  </code></pre>
  
  <p>which generates a syntax error in PostgreSQL 10.4.</p>
  
  <p>Why does this error?</p>
  
  <p>It looks like I will be creating a view instead. Is there a better solution?</p>