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
instance.getThing() fails on many-to-many with non-primary target key #11587
Comments
instance.getThing()
fails on many-to-many with non-primary target key
As shown in the SSCCE, the query is generated incorrectly... For example, in MSSQL:
SQL Generated: # ...
ON [captain].[id] = [foobar].[captainNickname]
# ... SQL Expected: # ...
ON [captain].[nickname] = [foobar].[captainNickname]
# ... |
@fboechats Would you like to try to take this one? |
@papb Sure, I can take this one. |
@papb Hello, I'm kinda lost in this problem, sorry for that. I didn't find how to manage that selection and don't have him thinking it's a number id over a string. |
@fboechats No problem, thanks for taking the time regardless :) |
I think I have the same problem... I have these relations:
When i call category.getProducts_children({ limit: 10}); SQL Generated:
SQL Expected:
The sequelize ignore my targetKey: 'category_id' and use the primary key. |
Issue Description
What are you doing?
Here is the link to the SSCCE for this issue: sequelize-sscce#16
Summary:
What do you expect to happen?
See the SSCCE,
ship.getCaptains()
should return somethingWhat is actually happening?
See the SSCCE,
ship.getCaptains()
is returning an empty arrayAdditional context
This refers to the functionality added by #11311
Environment
Issue Template Checklist
How does this problem relate to dialects?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: