You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SQL builder: an operation on a nullable column declares a non-null result #31006
An operation that accepts a nullable column declares a non-null result, so a selected result can be null while its type says it can't:
constrows=awaitruntime().query(db().public.users.outerLeftJoin(db().public.profiles,(f,fns)=>fns.eq(f.users.id,f.profiles.user_id)).select('bioMatches',(f,fns)=>fns.ilike(f.profiles.bio,'%BIO%')).build(),);// bioMatches is typed boolean, but Postgres returns null for a user with no profile
In a where this does no harm, because a NULL condition excludes the row. It matters only when the result is selected.
Every operation that takes a nullable receiver has this gap:
pgvector: cosineDistance and the other distance operations (packages/3-extensions/pgvector/src/types/operation-types.ts).
PostGIS: distance and the other measurement operations (packages/3-extensions/postgis/src/types/operation-types.ts).
Postgres target: ilike and fullTextMatches (packages/3-targets/postgres/1-target/src/types/operation-types.ts).
What we want
The result's nullability follows the receiver's: a nullable column gives a nullable result, and a non-null column keeps the non-null result it has today. The static result types and the run-time returns.nullable descriptors both need to change, across every extension at once, so the SQL builder stays consistent.
Hi team, I would like to help resolve this issue. I have reproduced the typing and run-time mismatch where operations on nullable receiver columns declare non-null results in selected projections across the SQL builder extension operation types (, , and targets). Could you please assign this to me?
Activity
sundeep8967 commentedon Nov 13, 2026
Hi team, I would like to help resolve this issue. I have reproduced the typing and run-time mismatch where operations on nullable receiver columns declare non-null results in selected projections across the SQL builder extension operation types (, , and targets). Could you please assign this to me?
fix(target-postgres): ilike and fullTextMatches accept a nullable tex…
fix(sql-builder)!: a column name that several joined tables share mus…