Specifying through.attributes
does not filter columns in through tables
#11819
Labels
existing workaround
For issues. There is a known workaround for this issue.
status: understood
For issues. Applied when the issue is understood / reproducible.
type: bug
Issue Description
What are you doing?
Let's say we have three tables:
users
,tasks
andparticipation
. There's a n:m relation betweenusers
andtasks
, which is based on the through tableparticipations
.The through table has many columns. In some scenarios, only one of them is needed. So I write some query like this:
But the query result still contains all columns. I also found this issue: #5590. But
includeIgnoreAttributes
seems doesn't work at all.Here is the link to the SSCCE for this issue: sequelize/sequelize-sscce#33
What do you expect to happen?
The generated SQL query should only contain column
role
in tableparticipations
.What is actually happening?
The generated SQL query contains all columns in table
participations
. A direct link to this line in CI output. Below is a formatted one.Additional context
Add any other context or screenshots about the feature request? Nope.
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: