#36702: bulk_create not returning pk if it was set as an expression
-------------------------------------+-------------------------------------
Reporter: Johannes Westphal | Type:
| Uncategorized
Status: new | Component: Database
| layer (models, ORM)
Version: 5.2 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Currently, when the pk is set on an object passed to `bulk_create` the pk
is explicitly not updated in the object:
https://github.com/django/django/blob/05ba1a9228128614fb3c475f1c4bdf0160f44dba/django/db/models/query.py#L843
This becomes a problem if the pk of the object has been set to an
expression, because then we have no access to the actual generated pk even
though the db returned it.
Would it break any functionality to just remove the line above and also
update the pk even if it had been set?
--
Ticket URL: <https://code.djangoproject.com/ticket/36702>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019a3f300494-7f35fb85-e936-442f-be1c-08d6790d9447-000000%40eu-central-1.amazonses.com.