mgarf
mgarf
DTDrizzle Team
Created by mgarf on 7/29/2023 in #help
Cannot query DB table get `COALESCE types smallint and text cannot be matched`
When i run the following query
let tc = await db.query.ATable.findFirst({
where: and(
eq(ATable.year, year),
eq(ATable.week, week),
eq(ATable.ownerId, userId)
),
with: {
bs: true,
cs: true
}
})
let tc = await db.query.ATable.findFirst({
where: and(
eq(ATable.year, year),
eq(ATable.week, week),
eq(ATable.ownerId, userId)
),
with: {
bs: true,
cs: true
}
})
I get the query error COALESCE types smallint and text cannot be matched. Any thoughts on how I can get around this? Schema posted in the comments
4 replies
DTDrizzle Team
Created by mgarf on 7/5/2023 in #help
findmany doesn't easily allow gte or lte?
When looking at the typescript definition of the operators in the findmany where clause I see:
declare const operators: {
sql: typeof sql;
eq: typeof eq;
and: typeof and;
or: typeof or;
};
declare const operators: {
sql: typeof sql;
eq: typeof eq;
and: typeof and;
or: typeof or;
};
.findMany({
where: (table, operators) => (),
with: {
project: true
}
});
.findMany({
where: (table, operators) => (),
with: {
project: true
}
});
I expected to see lte/gte or even just gt, lt for the Postgrl neon configution. Is it expected that we use the raw sql operator? or is this unintentionally missing?
3 replies