Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.11.0: Unique constraint failed on the fields on query that worked in 4.10.1 #18186

Closed
janpio opened this issue Mar 2, 2023 · 6 comments · Fixed by prisma/prisma-engines#3762
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. topic: null
Milestone

Comments

@janpio
Copy link
Member

janpio commented Mar 2, 2023

Reproduction repository: https://github.com/janpio/prisma-4.11-pdp-regression

@janpio janpio added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. kind/bug A reported bug. topic: null team/client Issue for team Client. kind/regression A reported bug in functionality that used to work before. bug/2-confirmed Bug has been reproduced and confirmed. and removed kind/bug A reported bug. bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. labels Mar 2, 2023
@janpio
Copy link
Member Author

janpio commented Mar 2, 2023

Workaround: The problem is caused by the unique field WART_id in the example. When it is created not with null but a unique value (e.g. i form the loop) the code runs successfully.

@miguelff
Copy link
Contributor

Created a reproduction in prisma-engines and bisect it through the commit history.

The regression started from this commit. prisma/prisma-engines@9984a8d I will take it from here.

@miguelff
Copy link
Contributor

It was fixed later by prisma/prisma-engines@2f443b1 so this is no longer an issue

@janpio
Copy link
Member Author

janpio commented Mar 21, 2023

My reproduction is unfortunately still failing with the latest prisma@dev and @prisma/client@dev which is currently 4.12.0-dev.13. Did this maybe not get integrated and release into the CLI and Client yet?

Params: [0,0]
Query: UPDATE "public"."with_compound_unique" SET "WART_id" = $1 WHERE "public"."with_compound_unique"."WART_id" IS NULL
Params: [0]
Query: ROLLBACK
Params: []
PrismaClientKnownRequestError: 
Invalid `prisma.with_all_relation_types.update()` invocation in
/workspace/prisma-4.11-pdp-regression/script.js:37:40

  34 
  35 }
  36 
→ 37 await prisma.with_all_relation_types.update(
Unique constraint failed on the fields: (`WART_id`)
    at Zr.handleRequestError (/workspace/prisma-4.11-pdp-regression/node_modules/@prisma/client/runtime/library.js:171:6414)
    at Zr.handleAndLogRequestError (/workspace/prisma-4.11-pdp-regression/node_modules/@prisma/client/runtime/library.js:171:5948)
    at Zr.request (/workspace/prisma-4.11-pdp-regression/node_modules/@prisma/client/runtime/library.js:171:5786)
    at async t._request (/workspace/prisma-4.11-pdp-regression/node_modules/@prisma/client/runtime/library.js:174:10455)
    at async main (/workspace/prisma-4.11-pdp-regression/script.js:37:3) {
  code: 'P2002',
  clientVersion: '4.12.0-dev.13',
  meta: { target: [ 'WART_id' ] }
}

@janpio janpio reopened this Mar 21, 2023
@miguelff
Copy link
Contributor

Did this maybe not get integrated and release into the CLI and Client yet?

Exactly, the revision of prisma engines used in this version does not include prisma/prisma-engines@2f443b1

From npm → Code → Prisma commit 7893f1afprisma-engines @ 3b9f029a (earlier than prisma/prisma-engines@2f443b1)

@janpio
Copy link
Member Author

janpio commented Mar 24, 2023

I can now confirm that this is fixed in 4.12.0-dev.30 🥳

@janpio janpio closed this as completed Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/regression A reported bug in functionality that used to work before. team/client Issue for team Client. topic: null
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants