When I create a record that has a relation, I get the following error:
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("42601"), message: "syntax error at or near \")\"", detail: None, hint: None, position: Some(Original(57)), where_: None, schema: None, table: None, column: None, datatype: None, constraint: None, file: Some("scan.l"), line: Some(1145), routine: Some("scanner_yyerror") }) }) })
at PrismaClientFetcher.request (/home/oden/Dev/Templates/test/node_modules/@prisma/client/runtime/index.js:1:51485)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
I created a minimal repro to demonstrate the issue: https://github.com/odensc/prisma-repro
npm installprisma2 migrate up --experimentalnode index.jsSeems like the issue is here:
prisma:query SELECT "public"."Post"."id" FROM "public"."Post" WHERE () IN (($1)) OFFSET $2
You can see the WHERE parameter list is empty.
The create call should work and returns the new record.
All included in the repo.
Same error as #578 it seems but different data model.
I traced this back to the breaking relation change in 2.0.0-beta.1.
Apparently I decided to start fiddling around literally minutes after 2.0.0-beta.1 was released, but before the GitHub docs were redirected to prisma.io - so I was working off the old documentation regarding relations. Just unlucky :)
So I suppose the real issue is that the error message could be more helpful :+1: Would you prefer I open a new issue for that, or edit this one?
This will be fixed once we have improved the validation of @relation. Currently the schema validation does not fail when fields is required but not specified.
You should get an error during generate now.
@janpio Can confirm. Thanks!
Most helpful comment
I traced this back to the breaking relation change in
2.0.0-beta.1.Apparently I decided to start fiddling around literally minutes after
2.0.0-beta.1was released, but before the GitHub docs were redirected to prisma.io - so I was working off the old documentation regarding relations. Just unlucky :)So I suppose the real issue is that the error message could be more helpful :+1: Would you prefer I open a new issue for that, or edit this one?