title: Column does not exists in outer join after alias
body: <p>I have a problem with the next SQL query (generated by sequelize ORM):</p>
  
  <pre><code>SELECT 
      "Publication".*, 
      "user"."id" AS "user.id"
  FROM 
      (SELECT "Publication"."club_id" AS "clubId", "Publication"."user_id" AS "userId" FROM "publication" AS "Publication" WHERE ("Publication"."club_id" = '1')) AS "Publication" 
      LEFT OUTER JOIN "user_account" AS "user" ON "Publication"."user_id" = "user"."id";
  </code></pre>
  
  <p>The resulting error is:</p>
  
  <blockquote>
    <p>ERROR:  column Publication.user_id does not exist</p>
    
    <p>LINE 6:  LEFT OUTER JOIN "user_account" AS "user" ON "Publication"."...
                                                             ^</p>
  </blockquote>
  
  <p>My intuition of what is happening is that <code>"Publication"."user_id"</code> is being aliased as <code>userId</code>. Then, the query is being aliased as <code>"Publication"</code>(overwriting the label which was previously refering to the table). The left outer join tries to match new the <code>Publication</code> <code>user_id</code> property with <code>user.id</code>, but it is unable because now it is called <code>userId</code>.</p>
  
  <p>Am I correctly understanding the problem?</p>