#36086: Creating an instance of a model with a non-auto primary key and a
generated
field crashes on backends not supporting returning columns from inserts
-------------------------------------+-------------------------------------
Reporter: Simon Charette | Owner: Simon
| Charette
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):
* resolution: => fixed
* status: assigned => closed
Comment:
In [changeset:"9e552015556661d183a999078a9e846200ef6765" 9e55201]:
{{{#!CommitTicketReference repository=""
revision="9e552015556661d183a999078a9e846200ef6765"
Fixed #36086 -- Fixed crash when using GeneratedField with non-AutoField
pk.
The previous logic was systematically attempting to retrieve
last_insert_id
even for models without an AutoField primary key when they had a
GeneratedField
on backends that can't return columns from INSERT.
The issue affected MySQL, SQLite < 3.35, and Oracle when the
use_returning_into
option was disabled and could result in either crashes when the non-auto
primary key wasn't an IntegerField subclass or silent misassignment of
bogus
insert ids (0 or the previous auto primary key insert value) to the first
defined generated field value.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36086#comment:5>
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/010701945f278db3-c5a43089-000d-43be-9b0e-306d06281e94-000000%40eu-central-1.amazonses.com.