Bug: Count in Extras (Relational)
Trying to use the example from: https://orm.drizzle.team/docs/query-utils#count
it seems like the output SQL query is WRONG -- it is attempting to match on
label.danceId
instead of label.id
Drizzle ORM - Utils
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
6 Replies
Getting the same kind of error.
PostgresError: column projects_tasks.task_id does not exist
Anyone got a solution?
Glad to see im not the only one -- this looks easily repro-able, so hopefully a solution wont be too complex
ALL of these are related:
https://github.com/drizzle-team/drizzle-orm/discussions/3119#discussioncomment-12095595
https://github.com/drizzle-team/drizzle-orm/issues/4164
https://github.com/drizzle-team/drizzle-orm/issues/3546
https://github.com/drizzle-team/drizzle-orm/issues/3110
https://github.com/drizzle-team/drizzle-orm/issues/3493
https://github.com/drizzle-team/drizzle-orm/issues/1815
GitHub
[BUG]: wrong table name generated in
$count
sub-expression · Iss...Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.39.3 What version of drizzle-kit...
GitHub
[BUG]: extras in findMany count relations is not working · Issue #...
Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.35.2 What version of drizzle-kit...
GitHub
[BUG]: Query extras resolve table names incorrectly · Issue #3110 ...
What version of drizzle-orm are you using? 0.34.1 What version of drizzle-kit are you using? 0.25.0 Describe the Bug I'm running following query in my code: await db.query.contractors.findMany(...
GitHub
[BUG]: db.$count inside relational query "extras" generates SQL wit...
Report hasn't been filed before. I have verified that the bug I'm about to report hasn't been filed before. What version of drizzle-orm are you using? 0.36.0 What version of drizzle-kit...
GitHub
$count · drizzle-team drizzle-orm · Discussion #3119
In recent release we've introduced $count API and I wanted to shine some light on why we decided to implement one. We pursue SQL-likeness with Drizzle, yet sometimes pure SQL is just bad, this ...
Thank you for linking these, looked through them and found a solution in the comments (hardcoding the table/field names in the eq) :)
Do you know if we can do anything to get the maintainers to solve the actual issue for us?
nope no idea 😅