You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.40.1
What version of drizzle-kit are you using?
not related
Other packages
No response
Describe the Bug
What is the undesired behavior?
When using Drizzle Prisma with select statements, field renaming does not work correctly when selecting multiple fields with the same name (e.g., id from different relations). Instead of returning the renamed fields, only one field is returned, leading to data loss.
What are the steps to reproduce it?
Define Prisma models where related tables contain fields with the same name (e.g., id in User and Post models).
Use Drizzle Prisma to perform a select query with renaming, attempting to distinguish fields using aliases.
Execute the query and observe the returned result. What is the desired result?
The query should return properly renamed fields, ensuring that both userId and postId appear distinctly in the result set.
What is the actual result?
Instead of returning renamed fields (userId, postId), the response contains only one field (id), causing the loss of data from one of the tables.
Additional Information:
Database Engine: MySQL
Potentially Related to Database Driver? Possibly related to how Drizzle Prisma handles aliasing in SQL queries.
Monorepo? Yes
TypeScript Version: (5.8.2)
Runtime: Node.js (22.12)
Report hasn't been filed before.
What version of
drizzle-orm
are you using?0.40.1
What version of
drizzle-kit
are you using?not related
Other packages
No response
Describe the Bug
What is the undesired behavior?
When using Drizzle Prisma with select statements, field renaming does not work correctly when selecting multiple fields with the same name (e.g., id from different relations). Instead of returning the renamed fields, only one field is returned, leading to data loss.
What are the steps to reproduce it?
Define Prisma models where related tables contain fields with the same name (e.g., id in User and Post models).
Use Drizzle Prisma to perform a select query with renaming, attempting to distinguish fields using aliases.
Execute the query and observe the returned result.
What is the desired result?
The query should return properly renamed fields, ensuring that both userId and postId appear distinctly in the result set.
What is the actual result?
Instead of returning renamed fields (userId, postId), the response contains only one field (id), causing the loss of data from one of the tables.
Additional Information:
Database Engine: MySQL
Potentially Related to Database Driver? Possibly related to how Drizzle Prisma handles aliasing in SQL queries.
Monorepo? Yes
TypeScript Version: (5.8.2)
Runtime: Node.js (22.12)
Example of the issue :
https://github.com/amaurycoudr/prisma-drizzle-issue
The text was updated successfully, but these errors were encountered: