You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(although this one can be done with the not_ (is ...) function)
The IS binary operator is most commonly seen in IS NULL and IS NOT NULL. esqueleto indeed has this in the isNothing function, but they can also be used for other values, e.g. foo IS true. The reason to use IS over = here is because they have different behaviors regarding NULL.
Here are the truth tables for x = y and x IS y for booleans:
x = y
true
false
NULL
true
true
false
NULL
false
false
true
NULL
NULL
NULL
NULL
NULL
x IS y
true
false
NULL
true
true
false
false
false
false
true
false
NULL
false
false
true
I didn't make a pull request because this function might be up to debate. Arguably, one might say that with a correct Persistent table definition, you statically know whether a column is NULL or not, so the IS operator may not technically be needed. On the other hand, there might be other expressions where NULL sneaks in to give funny behavior. What do you think?
Also, apologies if this issue is duplicate. It's kind of hard to search for a two-letter operator 😅
The text was updated successfully, but these errors were encountered:
Is IS supported like this in all databases? If so, is there ever a reason to use =? Does IS perform differently? Honestly it feels like .== should just use IS if this is actually supported in all 3 of our supported DBs
I found myself manually creating the following definition:
Equivalently, one can imagine the following operator:
(although this one can be done with the
not_ (is ...)
function)The
IS
binary operator is most commonly seen inIS NULL
andIS NOT NULL
. esqueleto indeed has this in theisNothing
function, but they can also be used for other values, e.g.foo IS true
. The reason to useIS
over=
here is because they have different behaviors regarding NULL.Here are the truth tables for
x = y
andx IS y
for booleans:x = y
true
false
NULL
true
true
false
NULL
false
false
true
NULL
NULL
NULL
NULL
NULL
x IS y
true
false
NULL
true
true
false
false
false
false
true
false
NULL
false
false
true
I didn't make a pull request because this function might be up to debate. Arguably, one might say that with a correct Persistent table definition, you statically know whether a column is NULL or not, so the
IS
operator may not technically be needed. On the other hand, there might be other expressions whereNULL
sneaks in to give funny behavior. What do you think?Also, apologies if this issue is duplicate. It's kind of hard to search for a two-letter operator 😅
The text was updated successfully, but these errors were encountered: