I created a minimal sample showing the error: https://github.com/esistgut/prisma-issue
To run the sample first execute npm i && npm run prismation. There are two functions: populate to create the required data and test to show the error. Please comment/uncomment as required (populate should only be run once).
The test should show the following error:
(MariaDB)
PrismaClientUnknownRequestError:
Invalid `prisma.services.findMany()` invocation in
/home/esistgut/coding/typescript/prisma-test/index.ts:92:57
→ 88 Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Server(ServerError { code: 1241, message: "Operand should contain 1 column(s)", state: "21000" })) })
at PrismaClientFetcher.request (/home/esistgut/coding/typescript/prisma-test/node_modules/@prisma/client/index.js:89:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Sqlite)
PrismaClientUnknownRequestError:
Invalid `prisma.services.findMany()` invocation in
/home/esistgut/coding/typescript/prisma-test/index.ts:92:57
→ 88 Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("sub-select returns 4 columns - expected 1"))) })
at PrismaClientFetcher.request (/home/esistgut/coding/typescript/prisma-test/node_modules/@prisma/client/index.js:89:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
This looks like a bug but I'm not really sure about it.
I simplified my test after receiving some input on Slack. The error is still there.
Thanks for the reproduction. That was really helpful. I can also confirm this happens with preview023 as well.
Laying out reproduction steps here so that we can quickly go through them:
npm installnpm run prismation (This will run prisma2 migrate)index.ts and execute the populate method in maints-node index.tstest method in main functionts-node index.ts to reproduce.Is there any way around this at the moment?
Might be the same as: https://github.com/prisma/prisma/issues/3078