Skip to content

Commit

Permalink
Fix multiple columns with same name error for JOIN USING (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber authored Nov 5, 2023
1 parent 114fb05 commit 9f41ad0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ internal abstract class JoinClauseMixin(
column is PsiNamedElement && column.name!! in subquery.queryExposed()
.flatMap { it.columns }
.mapNotNull { (it.element as? PsiNamedElement)?.name }
},
}
.distinctBy { (it.element as? PsiNamedElement)?.name ?: it },
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ WHERE id IN (
SELECT foo.id FROM foo
LEFT JOIN bar ON foo.id = bar.id
LEFT JOIN baz ON foo.id = baz.id
);
);

SELECT *
FROM foo
JOIN bar USING (id)
JOIN baz USING (id);

0 comments on commit 9f41ad0

Please sign in to comment.