#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):
Another reason why `use_returning_into=False` is broken is that it `SELECT
sequence_name.currval` doesn't account for concurrent `INSERT`. From what
I understand, just like in Postgres, Oracle sequences are not tied to
transactions which means that nothing prevents a concurrent `INSERT` from
being executed in a separate transaction and increasing the sequence
before it can be `SELECT`ed.
e.g.
- session0: `INSERT`
- session1: `INSERT`
- session0: `SELECT sequence_name.currval`
- session1: `SELECT sequence_name.currval`
Both session 0 and 1 assume that their `last_insert_id` is the same;
session 0 is wrong.
--
Ticket URL: <https://code.djangoproject.com/ticket/36189#comment:4>
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/0107019517758195-8b7decf6-aebd-4550-b52c-7a5a1260cafa-000000%40eu-central-1.amazonses.com.