drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: operator function for `is distinct from` (SQL:1999 standard T151)

Open
#1,733 4 comments 7 reactions 0 assignees View on GitHub
enhancement qb/crud
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Describe what you want

This is useful for comparing two values where one of them may be null. The `=` operator used by `eq(` and the `not` operator from `not(` both return null when any input is null.

As a result, to compare a potentially null column to a value, you need to do, e.g. for checking non-equality:
```ts
or(isNull(myColumn), not(eq(myColumn, "myValue")))
```

It would be great to have a function to allow us to do e.g. `distinct(myColumn, "myValue")` which would generate `myColumn is distinct from 'myValue'`, therefore handling the null check and the equality check in a single condition.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.