-
Notifications
You must be signed in to change notification settings - Fork 284
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
Add IS DISTINCT FROM and IS NOT DISTINCT FROM operators for Postgres #673
Comments
How's that different from You can already use any operator like this: where('foo', sql`is distinct from`, bar) |
Like this: SELECT NULL IS DISTINCT FROM NULL; -- false
SELECT NULL IS NOT DISTINCT FROM NULL; -- true
SELECT 'value' IS DISTINCT FROM NULL; -- true
SELECT 'value' IS NOT DISTINCT FROM NULL; -- false
SELECT 'value' IS DISTINCT FROM 'value'; -- true
SELECT 'value' IS NOT DISTINCT FROM 'value'; -- false The key difference is that it handles NULL and non-NULL values in a single statement, without needing to do things like
This was what I initially tried, but the TypeScript inference here breaks badly in some situations, like if you have a |
Breaks how? |
@icopp What do you mean by
Could you provide the code you're running and the error you get. |
These are functionally identical to
<>
and=
respectively, except that they treatNULL
as a known value (e.g.NULL IS DISTINCT FROM 'value'
returnsTRUE
,NULL IS NOT DISTINCT FROM 'value'
returnsFALSE
).The text was updated successfully, but these errors were encountered: