drizzle-team / drizzle-team/drizzle-orm

[FEATURE]: Empty disjunctions should filter everything

Open
#4,261 0 comments 1 reaction 1 assignee Claimed by @AndriiSherman View on GitHub
enhancement improvement
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Feature hasn't been suggested before.

- [x] I have verified this feature I'm about to request hasn't been suggested before.

### Describe the enhancement you want to request

Just flagging that in traditional logic empty disjunctions tend to be identified with falsehood. Under this identification, providing an empty disjunction `or()` to a `where` clause would create a totally exclusive filter-- every result is filtered out.

However, currently, an empty disjunction produces `undefined` ([source](https://github.com/drizzle-team/drizzle-orm/blob/53f578c11a77c7c086f9c3ed897afdebce7ed6e6/drizzle-orm/src/sql/expressions/conditions.ts#L152)), which, based on the conditional filtering API ([docs](https://orm.drizzle.team/docs/guides/conditional-filters-in-query)), seems like it results in a totally inclusive filter, including every result instead.

This might warrant reconsideration in some future major release of drizzle.

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.