-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Query returning duplicate values #10238
Comments
Thanks for reporting. We are working on a fix. |
…ows (#463) ### What We are fixing two bugs: 1. Fix returning duplicate results when filtering hasura/graphql-engine#10238 2. Fix over-filtering when a related table contains no results (due to the use of inner join) <!-- Consider: do we need to add a changelog entry? --> ### How In order to filter by a nested relationship column, we first query that nesting to fetch the relevant column, and then build our filter. Before, we fetched the tables at the top-level using an inner join, then added a where clause. In this PR we change this generation scheme to use `WHERE EXISTS (SELECT 1 ...)` instead. The fetching of columns will appear inside the `WHERE` clause, each path element will have it's own select (where the nesting are combined using inner joins) and separate path elements are combined with a FULL OUTER JOIN instead of inner join. The `EXISTS` part helps us avoid duplicates - while inner joins at the top-level can create additional rows, an EXISTS cannot. It will just inform if a particular row matches the predicate. The `FULL OUTER JOIN` part helps us avoid over-eager filtering. See the [note here](#463 (comment)).
@soupi thank you for taking a look! Any way you can cut a new release with the fix? |
@arjunyel Yes, we've just deployed the fix to production and it should now be available for ddn cloud users. |
@soupi sorry how do I use this in DDN cloud? The only control I have over versions only let's me do 0.6.0 |
@arjunyel no further action should be needed, it should just work as expected now. Please let me know if it doesn't. |
@soupi its working great, thank so much for the quick and comprehensive fix! |
Great to hear. Thanks for the update! |
A query like this:
Is returning duplicated values due to the tags.
Notice the duplicates for Drew 1 and Andrew 1.
The SQL generated misses a DISTINCT statement.
See the generated SQL:
The text was updated successfully, but these errors were encountered: