`null` is not assignable to nullable string column?
I'm trying to write a simple query but seem to be missing something.
See the of my table in the attachment. key_2 and key_3 are marked as nullable in my drizzle schema. However in the where clause it still doesn't allow me to pass null values
Argument of type 'null' is not assignable to parameter of type 'string | SQLWrapper'.
Overload 2 of 3, '(left: Aliased<null>, right: SQLWrapper | null): SQL<unknown>', gave the following error.
![No description](https://cdn.answeroverflow.com/1236843277827833956/image.png)
![No description](https://cdn.answeroverflow.com/1236843278339543161/image.png)
2 Replies
Use the
isNull
filter, rather than the eq
filter.https://orm.drizzle.team/docs/operators#isnull
https://www.postgresqltutorial.com/postgresql-tutorial/postgresql-is-null/
admin
PostgreSQL Tutorial
PostgreSQL IS NULL
In this tutorial, you will learn how to use the PostgreSQL IS NULL operator to check if a value is NULL or not.
Drizzle ORM - Filters
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.