Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compiler): Support LEFT JOIN on aliased table #2873

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

kyleconroy
Copy link
Collaborator

Fixes #1897

Comment on lines +427 to 434
tableMatch := *n.Relname == col.Table.Name
aliasMatch := true
if n.Alias != nil && col.TableAlias != "" {
aliasMatch = *n.Alias.Aliasname == col.TableAlias
}
if n.Alias != nil && *n.Alias.Aliasname == col.TableAlias && *n.Relname == col.Table.Name {
if aliasMatch && tableMatch {
return prior
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the column doesn't use a table alias, don't check that the aliases match.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems correct logically, although aliasMatch defaulting to true is potentially confusing to future readers. I might suggest just putting this comment you wrote in the actual source.

@kyleconroy kyleconroy merged commit 02c9e3d into main Oct 18, 2023
8 checks passed
@kyleconroy kyleconroy deleted the kyle/left-join-table-alias branch October 18, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LEFT JOIN not generating Null* types with table aliases
2 participants