-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Could :in support NULL? #315
Comments
That feels like "too much magic" to me but I'll give it some thought. |
Other cases to consider:
|
@brjann I'd love to get your feedback on the changes I've made to support this (on the v2 branch, it was added after Beta 1). |
Thanks @seancorfield , I really appreciate this! I have looked at the tests for the cases that include one or more
|
Regarding my first thought. Maybe there is actually no valid case where IN() should not be interpreted as matching no rows. |
Yeah, I'm on the fence about #1 -- but it sort of falls out of The problem with #2 is that it would become a combinatoric explosion of cases to handle so we definitely do not want to expand the |
#1. Sure. But I do have a specific use case where #2. I agree, supporting tuples would be very magical. But wouldn't become combinatorial though? One would just move every |
You're right that #2 wouldn't become combinatoric but in the case where you have a lot of tuples in the collection and, say, half of them have As for possibly handling So far, the only feedback on Slack is against this change on the basis that in general having an empty collection or |
Yes. That is probably the case. So silently passing that |
I've reverted the changes and I'm going to close this out. I'm probably going to add a |
SQL handles
NULL
in a special way, so you cannot writeWHERE col = NULL
. HoneySQL helps you out by parsing[:= col NULL]
ascol IS NULL
.IN
has the same problem.col IN (1,2,NULL)
does not work as expected, it does not return true ifcol
isNULL
Would it be too much magic if HoneySQL did something similar with
IN
as it does with=
?I.e. instead of
[:in col [1 2 nil]]
=>[col IN (?, ?, NULL)]
, it would parse as(([col IN (?, ?)]) OR col IS NULL)
. And if the vector only includesnil
, it would simply becomecol IS NULL
The text was updated successfully, but these errors were encountered: