Open pocin opened 1 year ago
when using db.sum() shortcut in a subquery the return type should be number| null because the subquery might not match any row.
db.sum()
number| null
const resp = await db.select('order', db.all, { lateral: db.sum('order_lines', {order_id: db.parent('id')}, {columns: ['amount']}) }).run(pool)
as is, the current code can crash at runtime with TypeError: Cannot read properties of null so i think it is a bug.
TypeError: Cannot read properties of null
Not sure if zapatos should coalesce under the hood, or return number|null and user should coalesce on their own.
number|null
when using
db.sum()
shortcut in a subquery the return type should benumber| null
because the subquery might not match any row.as is, the current code can crash at runtime with
TypeError: Cannot read properties of null
so i think it is a bug.Not sure if zapatos should coalesce under the hood, or return
number|null
and user should coalesce on their own.