[Django] #35334: Update Oracle backend supports_sequence_reset = True

18 views
Skip to first unread message

Django

unread,
Mar 27, 2024, 3:56:36 AM3/27/24
to django-...@googlegroups.com
#35334: Update Oracle backend supports_sequence_reset = True
-------------------------------------+-------------------------------------
Reporter: David | Owner: nobody
Sanders |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The Oracle backend currently specifies `supports_sequence_reset = False`.
It looks as though it's been this way since the flag was added to the
Oracle backend since https://github.com/django/django/commit/0df4593f0ed.

This commit appears to have been for the 1.5 release [1] which was
released in Feb 2013. A few months later Oracle 12.1 [2] was released in
July 2013. It's quite hard to determine when `ALTER SEQUENCE … RESTART`
support was introduced but from some pain-staking searching I found that
apparently 12.1 included support for it but it wasn't documented until 18c
[3]:

> There is a new option for altering a sequence that appeared in 12.1 but
was not documented until 18c:
> `alter SEQUENCE [schema_name.]{sequence_name} restart;`


[1] https://docs.djangoproject.com/en/5.0/releases/1.5/
[2] https://en.wikipedia.org/wiki/Oracle_Database#Releases_and_versions
[3] https://www.red-gate.com/simple-talk/databases/oracle-databases
/oracle-sequences-12c-features-including-identity/
--
Ticket URL: <https://code.djangoproject.com/ticket/35334>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 27, 2024, 9:26:56 AM3/27/24
to django-...@googlegroups.com
#35334: Update Oracle backend supports_sequence_reset = True
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 5.0
(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
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/35334#comment:1>

Django

unread,
Mar 27, 2024, 11:00:45 AM3/27/24
to django-...@googlegroups.com
#35334: Update Oracle backend supports_sequence_reset = True
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 5.0
(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 David Sanders):

Interestingly someone's already added the required sequence reset methods
to `db.backends.oracle.operations.DatabaseOperations` to support flushing:
https://github.com/django/django/blob/d658a3162fbeb68d148d1b2fcf4da4fe1437eddb/django/db/backends/oracle/operations.py#L526

The Oracle attribute
[https://github.com/django/django/blob/d658a3162fbeb68d148d1b2fcf4da4fe1437eddb/django/db/backends/oracle/operations.py#L39
DatabaseOperations.__sequence_reset_sql()] appears to have origins way
back to 2007 when it was first added as
[https://github.com/django/django/commit/ac64e91a0cadc57f4bc5c#diff-
5cae5e1a70c0f5badce41576684234d402babf2aa2546e5c2166d9041137458dR198
_get_sequence_reset_sql()]

It looks like that could be simplified to use the `ALTER` syntax?
--
Ticket URL: <https://code.djangoproject.com/ticket/35334#comment:2>

Django

unread,
Jun 21, 2024, 2:48:33 AM6/21/24
to django-...@googlegroups.com
#35334: Update Oracle backend supports_sequence_reset = True
-------------------------------------+-------------------------------------
Reporter: David Sanders | Owner:
Type: | amultani1234
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.0
(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
-------------------------------------+-------------------------------------
Changes (by amultani1234):

* owner: nobody => amultani1234
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35334#comment:3>
Reply all
Reply to author
Forward
0 new messages