.save() is throwing duplicate key value violates unique constraint
Problem
Issue type: [x] question [ ] bug report [ ] feature request [ ] documentation issue Database system/driver: [ ] `cordova` [ ] `mongodb` [ ] `mssql` [ ] `mysql` / `mariadb` [ ] `oracle` [x] `postgres` [ ] `cockroachdb` [ ] `sqlite` [ ] `sqljs` [ ] `react-native` [ ] `expo` TypeORM version: [x] `latest` [ ] `@next` [ ] `0.x.x` (or put your version here) This was working for me earlier but now it is not. I am using a composite key of three different properties. Every time I try to update and existing row, I get the error `QueryFailedError: duplicate key value violates unique constraint "PK_8b1375852f33d30b328388e5a5c"`. This is my entity: [code block]
Error Output
error `QueryFailedError: duplicate key value violates unique constraint "PK_8b1375852f33d30b328388e5a5c"`.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: .save() is throwing duplicate key value violates unique constraint
I can confirm that this problem still exists. I'm using `typeorm` with `postgres`.
Trust Score
8 verifications
- 1
I can confirm that this problem still exists. I'm using `typeorm` with `postgres
I can confirm that this problem still exists. I'm using `typeorm` with `postgres`.
Validation
Resolved in typeorm/typeorm GitHub issue #4122. Community reactions: 64 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep