DT
Join ServerDrizzle Team
help
numeric returns string when querying with Postgres
export const order = pgTable(
'orders', {
...
totalValue: numeric('total_value', { precision: 10, scale: 2 }),
...
})
inspecting
order.totalValue
I get typePgNumeric<{
tableName: "orders";
name: "total_value";
data: string;
driverParam: string;
notNull: false;
hasDefault: false;
}>
but when I do a query such as
await db
.insert(order)
.values({
...input,
})
.returning();
The result is inferred as
string | null
for this column rather than number | null
linked issue: https://github.com/drizzle-team/drizzle-orm/issues/570 (for Drizzle team)