-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Bug: Equality checks on optional parameter don't work when it's undefined. Can't check if undefined. #3523
Comments
Dupe of #704 |
I don't think this is a duplicate, since that issue refers to |
That logic can't be used on parameters. If you do
It evaluates to true when $user_id is undefined, which is counterintuitive and dangerous since using this in mutations could be disastrous. Reopening as I think you're right that it's not a duplicate issue. |
What about making the type non-nullable? i.e. |
The use case is an upsert mutation. I have relationships between 3 tables. The situation is I want to upsert users, and if they've changed orgs, transfer their lists to the new org. Relationships:
In the case of the new user, this will update all lists org_id to $org_id. Due to this bug, doing what I want either requires 2 calls or including all lists in the $user payload with the new org_id. |
I think I understand the problem then. Would something like the following work?
You could then query with parameters The reason
which is equivalent to no filter at all. @0x777 might have an opinion on whether that's a bug or not? |
@rccoe is your question answered? If yes, we can close this issue 🙂 |
@rccoe I'm closing this issue. Feel free to re-open if you'd like to add anything 🙂 |
I'm running this query:
GetUserFromList($user_id: Int) { list( where: {_and: [{ user_id: { _eq: $user_id }}, {user_id:{_neq:null}}]} ) { user_id } }
and getting these results
"data": { "list": [ { "user_id": 14 }, ...
How can I filter out where the user_id = null? I'm running a mutation using this logic and it's updating everything in the table when user_id = null
Thanks!
The text was updated successfully, but these errors were encountered: