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

Join returns list (instead of object) on 1-to-1 relationship #905

Open
nik2208 opened this issue Sep 7, 2022 · 4 comments
Open

Join returns list (instead of object) on 1-to-1 relationship #905

nik2208 opened this issue Sep 7, 2022 · 4 comments
Assignees

Comments

@nik2208
Copy link
Contributor

nik2208 commented Sep 7, 2022

join returns a subobject array even if it has a 1 to 1 relationship

not really a problem.. just not to access the object using its index [0]

@mevdschee
Copy link
Owner

How would one differentiate a 1 to 1 relationship from a 1 to many relationship in SQL? Can you share your table create script for two tables with a 1 to 1 relationship?

@mevdschee mevdschee self-assigned this Sep 8, 2022
@nik2208
Copy link
Contributor Author

nik2208 commented Sep 8, 2022

well.. most of the times I try to find myself around..maybe I'm missing something.. but if u set the foreign key as unique key you get a 1 to 1 relationship.. am I wrong?

@mevdschee
Copy link
Owner

am I wrong?

No.. you aren't, it is a great suggestion. I guess I could try to detect the combination of a FK and a unique constraint. I'll turn this into an enhancement.

@mevdschee mevdschee changed the title join returns a subobject array even if it has a 1 to 1 relationship Join returns list (instead of object) on 1-to-1 relationship Sep 8, 2022
@mevdschee
Copy link
Owner

There may be a problem of a table having two 1-on-1 relationships with another table, but that is an edge case and may be solved with some form of aliasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants