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
findMany broken with many relations to same entity #12206
Comments
I hope you can just tell me that I'm doing something wrong because the alternative where prisma isn't resolving these relations correctly would be quite a substantial bug. 🤞 |
On further investigation, it is an issue with the BigInt type specifically as the primary key between the two entities. It looks like prisma swapped from BigInt to bigint in version 2.22.0 and it was broken until 2.24.0. BigInt works correctly as of 2.22.0 but when it is fixed in 2.24.0, this bug exists from that version in every version until 3.10.0. I saw this commit in 2.24.0 but doesn't seem that suspect. https://github.com/prisma/prisma-engines/pull/1975/files |
I've encountered the same problem too. I feel like Prisma is slightly lacking in support for That being said, I had a look through the JS/TS codebase and couldn't find anything that hinted a bug in the code. Perhaps there is something else going on in the Rust engine itself. I've tracked down the many-to-many nested read implemention to this particular file: https://github.com/prisma/prisma-engines/blob/main/query-engine/core/src/interpreter/query_interpreters/nested_read.rs#L10 Unfortunately I'm not familiar with Rust so I'm not sure how to replicate the bug and fix it. Feel free to ping me and I'm happy to work on it together |
Hey @dagistan-tuncbilek, It would be very helpful if you could open another issue and provide a reproduction (that includes seed data). That'd make it very easy for us to fix your issue. Thank you 🙏 |
Please see the issue #14019 |
Hey, This issue was just fixed and will be available in the next release (4.0). Thanks for reporting 🙏 |
Thank you @dagistan-tuncbilek, we'll have a look 🙏 |
Excellent, thankyou for resolving it @Weakky |
Bug description
When making a findMany query to an entity (A) that has a ManyToMany relation to another entity (B), if B is referred to in many of the returned A entities, only one of the A entities actually has B returned.
How to reproduce
Expected behavior
All related entities should be returned correctly in the prisma mapping.
Prisma information
Schema
Query
Environment & setup
Prisma Version
Example:
This query:
returns the following for the respective args:
The findMany query for the same group:
Returns:
As you can see, the first tag "test" is missing the user that "test2" shares with it
The text was updated successfully, but these errors were encountered: