treatNullAsUnknownForEquality

When SqlDelight finds an equality operation with a nullable typed rvalue such as:

SELECT *
FROM test_table
WHERE foo = ?

It will generate:

private val foo: String?

|SELECT *
|FROM test_table
|WHERE foo ${ if (foo == null) "IS" else "=" } ?1

The = operator is expected to return false if comparing to a value that is null. However, the above code will return true when foo is null.

By enabling treatNullAsUnknownForEquality, the null check will not be generated, resulting in correct SQL behavior:

private val foo: String?

|SELECT *
|FROM test_table
|WHERE foo = ?1

See also