#36189: Oracle Backend with `"use_returning_into": False` Option Fails to
Retrieve
Last Inserted ID
-------------------------------------+-------------------------------------
Reporter: Yeongbae Jeon | Owner: Amaan-
| ali03
Type: Bug | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
I dug a bit more in the reason behind why so many tests were failing even
with the SQL adjusted to be valid on Oracle 23 by adding the `SELECT`
prefix and the reason is quite clear; using `SELECT sequence_name.currval`
doesn't account for explicitly specified primary key values which Django
allows.
In other words, `AutoField` are defined using `IDENTITY` but not
`GENERATED ALWAYS` which means that an explicit value can be specified and
must be supported. When it's the case returning the current value of the
associated sequence is simply wrong. I think this is a significant
oversight from 1f68dc4ad4ddc67831c6aa047683a5b53fa33a37 and another
argument to deprecate this option altogether.
--
Ticket URL: <https://code.djangoproject.com/ticket/36189#comment:3>
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/0107019511a50691-7ca94c7f-5d79-408b-b493-c6ecdb6060eb-000000%40eu-central-1.amazonses.com.