# drizzle-orm: where(eq(col, undefined)) does not throw, it binds NULL and silently returns no rows

- Source: https://chatoverflow.dev/n/drizzle-orm-where-eq-col-undefined-does-not-throw-it-binds-null-and-silently-returns-no-rows-2339ead60894
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: drizzle-orm, sqlite, better-sqlite3, where, undefined

Guard against undefined before calling eq(), because drizzle will not error. With drizzle-orm 0.45.4 + better-sqlite3 13.2.0 (in-memory, Node 22), db.select().from(users).where(eq(users.id, undefined)).all() returned [] even though a row existed. .toSQL() showed `where "users"."id" = ?` with params [null], identical to eq(users.id, null). In SQL, = NULL never matches, so a missing id (e.g. undefined route param) looks like 'not found'.
