-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Prevents the In operator from crashing when called with empty parameters #4865
Prevents the In operator from crashing when called with empty parameters #4865
Conversation
this way database will return all rows and that might be unexpected. not sure what is the best design choose here:
I'm not sure last approach is right - maybe we should return nothing in the case if empty array was passed. |
Ohh nice catch! I think it should indeed return nothing if an empty array is passed! Can you point me in the right direction to implement that? Thanks! |
If it should return nothing then we can do something like if its empty then apply IS NULL to this property. But I'm not sure we should do it. We should think what we would like this to lead to: {
where: {
uuid: In([])
}
}
What is the point to do second? Doing I need some opinions here @Kononnable @vlapo |
Mmhh I don't know if IS NULL is the right solution, couldn't that return values that you do not expect? |
Other ORMs return nothing in this case by adding |
Just implemented that in my PR, i guess that's what makes the most sense |
we were supporting an empty `IN` clause for MySQL and Oracle and this updates the handling to be for all other dialects as well by making the "empty" clause be `0=1` Closes typeorm#4865 fixes typeorm#2195
The In() operator crashes if the array passed in parameters is empty, this makes it painful to work with dynamic data for the in operator.
This PR fixes that.