Null Check Operators
Checks whether a field is NULL or has a value, without comparing to a specific value.
| Operator | SQL | Meaning |
|---|---|---|
is | IS NULL / = | Null check or equality |
isn | IS NOT NULL / != | Not-null check or inequality |
exists | IS NOT NULL / IS NULL | Presence check |
notExists | IS NULL / IS NOT NULL | Inverse presence check |
is
typescript
{ where: { deletedAt: { is: null } } }
// SQL: WHERE "deleted_at" IS NULLNotice: is behaves exactly like eq - is: null compiles to IS NULL, is: <value> compiles to =.
Edge cases:
- The bare shorthand
{ deletedAt: null }(no operator key) is identical to{ deletedAt: { is: null } }. { is: 'active' }compiles to"status" = 'active', the same aseq.
isn
typescript
{ where: { verifiedAt: { isn: null } } }
// SQL: WHERE "verified_at" IS NOT NULLNotice: isn behaves exactly like ne/neq - isn: null compiles to IS NOT NULL, isn: <value> compiles to !=.
Edge cases:
- Same three-valued-logic caveat as
ne:{ isn: value }for a realvaluenever matches aNULLrow.
exists
typescript
{ where: { verifiedAt: { exists: true } } }
// SQL: WHERE "verified_at" IS NOT NULLNotice: exists takes a boolean, not a value - exists: false compiles to IS NULL, anything else compiles to IS NOT NULL.
Edge cases:
- Only the literal
falseselects theIS NULLbranch. - Any other operand, including
0or a truthy string, selectsIS NOT NULL. - Also works over a JSON path key, for example
{ 'metadata.score': { exists: true } }.
notExists
typescript
{ where: { verifiedAt: { notExists: true } } }
// SQL: WHERE "verified_at" IS NULLNotice: the inverse of exists - notExists: false compiles to IS NOT NULL, anything else compiles to IS NULL.
Edge cases:
- Same
false-only branch rule asexists.
See also
- Filter System Overview - the
filtershape and the fullwhereoperator table - Logical Operators -
not, the general-purpose negation operator - JSON Filtering -
existsalso works over a'column.path'key - Quick Reference - every operator, one line each
Files:
packages/connectors/src/relational/postgres/repositories/dialect/query.ts-PostgresQueryOperators.FNS, per-operator SQL builderspackages/connectors/src/relational/core/repositories/dialect/filter.ts-FilterBuilder, translatesTFilterto Drizzle/SQLpackages/filter/src/common/operators.ts-QueryOperatorsconstants