#29126 closed Cleanup/optimization (fixed)
Document the behavior of QuerySet.update_or_create() with manually specified pks
| Reported by: | Théo "Bob" Massard | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 2.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Upon using the update_or_create method on a Model which has a modified pk field, an IntegrityError happens.
psycopg2.IntegrityError: duplicate key value violates unique constraint "tags_pkey"
The PrimaryKey is an IntegerField with a modified db_column.
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
| Component: | Database layer (models, ORM) → Documentation |
|---|---|
| Has patch: | set |
| Summary: | Model.update_or_create method pk issue. → Document the behavior of QuerySet.update_or_create() with manually specified pks |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Bug → Cleanup/optimization |
comment:3 by , 8 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Oh, thanks a lot for pointing it out and updating the documentation!
Note:
See TracTickets
for help on using tickets.
Can you please include the model and steps to reproduce?