Opened 5 weeks ago
Closed 5 weeks ago
#35919 closed Uncategorized (duplicate)
bulk_create with update_conflicts=True does not return the primary keys of the created objects on MariaDb 10.10.7
Reported by: | Gerben Morsink | Owned by: | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
After updating Django to version 5.1 to use the bulk_create in combination with update_conflicts I found that bulk_create does still not return the primary keys of the created events on my setup. According to the docs this is a new addition in Django 5.0 that I would really like to use to create related objects in bulk. (the note in the docs: https://docs.djangoproject.com/en/5.1/ref/models/querysets/)
After trying bulk_update both with conflicts (validation of UniqueConstraint) and without, I found both ways without any luck.
Is there a discrepancy in the docs or should this actually work? I'm on MariaDB 10.10.7.
Duplicate of #19527 Allow QuerySet.bulk_create() to set the primary key of its objects.