Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change IN/NOT IN handling of empty arrays (Fixes #427)
Previously, Sequel was inconsistent in it's handling of empty arrays used with IN/NOT IN. It would try to handle NULLs correctly in the IN case, but not in the NOT IN case. This makes correct NULL handling the default in both cases. The actual behavior difference is that now in the NOT IN case, if the left hand side is NULL, the result of the expression is NULL instead of true. However, the correct NULL handling behavior can cause poor performance on databases with a lousy optimizer, such as MySQL. So there is a Sequel.empty_array_handle_nulls setting to change the behavior so it performs well, but may not handle NULLs correctly. Before: {:b => []} # (b != b) ~{:b => []} # (1 = 1) New Default: {:b => []} # (b != b) ~{:b => []} # (b = b) Sequel.empty_array_handle_nulls = false: {:b => []} # (1 = 0) ~{:b => []} # (1 = 1) "Correct" here is actually an opinion, not a fact. You could certainly argue that the static true/false behavior makes more logic sense. However, the default empty array behavior is certainly more consistent with the behavior in the non-empty array case.
- Loading branch information
1 parent
527f5ad
commit 4dec148
Showing
6 changed files
with
116 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters