Skip to content

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
@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