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

Gorm V2 cannot handle JOIN for tables with the same column name #5142

Closed
Joker666 opened this issue Mar 8, 2022 · 2 comments · Fixed by #5227
Closed

Gorm V2 cannot handle JOIN for tables with the same column name #5142

Joker666 opened this issue Mar 8, 2022 · 2 comments · Fixed by #5227
Assignees
Labels
type:with reproduction steps with reproduction steps

Comments

@Joker666
Copy link
Contributor

Joker666 commented Mar 8, 2022

GORM Playground Link

go-gorm/playground#460

Description

If two tables have the same column names like id and name, once we perform the JOIN query with a junction table in between, we see that the library does not populate the right value into the right struct. This happens due to how value is scanned back to the struct.

@Joker666
Copy link
Contributor Author

Fixed with #5143

@Joker666 Joker666 reopened this Apr 4, 2022
@Joker666
Copy link
Contributor Author

Joker666 commented Apr 4, 2022

This issue was fixed by #5143 but however, @jinzhu modified my commit to be more concise which resulted in a bug. That's why opening this issue again and going to send PR to fix the bug as well.

I also added a new playground PR go-gorm/playground#460 which has more robust test cases so that test will fail in case this bug regresses again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:with reproduction steps with reproduction steps
Projects
None yet
2 participants