Skip to content

Commit

Permalink
Fix multiple columns with same name error for JOIN USING
Browse files Browse the repository at this point in the history
  • Loading branch information
eygraber committed Nov 3, 2023
1 parent 3144c1f commit b2d603c
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 b2d603c

Please sign in to comment.