Issue resolving field names in multi-table query where clause

When trying to use query along with with clauses for relations. When building a where clause that references one of the included table fields - I am getting an error indicating that drizzle thinks the field belongs to the first table.
const result = await this.db.query.Table1.findMany({
where: and(eq(Table1.accountType, type), inArray(Table2.field1, field1s)),
with: {
table2entries: true,
},
})
const result = await this.db.query.Table1.findMany({
where: and(eq(Table1.accountType, type), inArray(Table2.field1, field1s)),
with: {
table2entries: true,
},
})
Gives an error:
error: column Table1.field1 does not exist
error: column Table1.field1 does not exist
It seems that this is a known bug from what I found on issues: https://github.com/drizzle-team/drizzle-orm/issues/3573 Is there any fix/workaround for this? Do I need to switch this query to insead use select() instead of query ?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?