Repository navigation
Description
Bug description
prismaClientUnknownRequestError2 [PrismaClientUnknownRequestError]: Invalidprisma.task.findMany() invocation: Error occurred during query execution: ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: Db, cause: Some(DbError { severity: "ERROR", parsed_severity: Some(Error), code: SqlState("42804"), message: "argument of JOIN/ON must be type boolean, not type record", detail: None, hint: None, position: Some(Original(383)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("parse_coerce.c"), line: Some(1156), routine: Some("coerce_to_boolean") }) }) }) at cb (/prisma-schema-orderby/node_modules/@prisma/client/runtime/index.js:35105:17) at processTicksAndRejections (internal/process/task_queues.js:93:5) { clientVersion: '2.23.0' }
How to reproduce
I prepare a simple project. There are 3 entities with composite keys. The last entity (TASK) has reference to Company and Project. I Can order tasks by Company_Name, but I cannot order them by Project_Name.
prisma-schema-orderby.zip
Expected behavior
Should order by Project_Name.
Prisma information
/**
* THIS WILL THROW AN ERROR
*/
const tasksOrderByprojectName = await prisma.task.findMany({
where: { deletedAt: null },
orderBy: {
project: {
name: "asc",
},
},
});
/**
* THIS IS OK
*/
const tasksOrderByCompanyName = await prisma.task.findMany({
where: { deletedAt: null },
orderBy: {
company: {
name: "asc",
},
},
});Environment & setup
- OS: Mac OS / Linux
- Database: PostgreSQL
- Node.js version: v14.15.4
Prisma Version
prisma : 2.23.0
@prisma/client : 2.23.0
Current platform : darwin
Query Engine : query-engine adf5e8cba3daf12d456d911d72b6e9418681b28b (at node_modules/@prisma/engines/query-engine-darwin)
Migration Engine : migration-engine-cli adf5e8cba3daf12d456d911d72b6e9418681b28b (at node_modules/@prisma/engines/migration-engine-darwin)
Introspection Engine : introspection-core adf5e8cba3daf12d456d911d72b6e9418681b28b (at node_modules/@prisma/engines/introspection-engine-darwin)
Format Binary : prisma-fmt adf5e8cba3daf12d456d911d72b6e9418681b28b (at node_modules/@prisma/engines/prisma-fmt-darwin)
Default Engines Hash : adf5e8cba3daf12d456d911d72b6e9418681b28b
Studio : 0.393.0
Preview Features : orderByRelation, selectRelationCount
Activity
thebiglabasky commentedon Jun 8, 2021
Candidating this one for next sprint to consider moving
orderByRelationout of preview.pantharshit00 commentedon Jun 9, 2021
I can reproduce this with
2.24.1. Thanks for the reprodution zip.SamuelMS commentedon Jun 20, 2021
This issue also seems to occur in
2.25.0when using_count(viaselectRelationCount) on a model that has a composite key.matthewmueller commentedon Jul 6, 2021
Internal Note: Candidating it since it's one of our oldest preview features 2.16.0 and we should consider looking into this before we remove the preview flag