[Django] #28670: django/db/backends/oracle/compiler.py handling of LIMIT+OFFSET could be better in Oracle 12+.

26 views
Skip to first unread message

Django

unread,
Oct 2, 2017, 3:28:42 PM10/2/17
to django-...@googlegroups.com
#28670: django/db/backends/oracle/compiler.py handling of LIMIT+OFFSET could be
better in Oracle 12+.
-------------------------------------+-------------------------------------
Reporter: Markus | Owner: nobody
Stenberg |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: 2.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 |
-------------------------------------+-------------------------------------
Currently the code which does the LIMIT+OFFSET clause emulation there with
ROWNUM (which assorted sources on the internet recommend not to do) is no
longer needed. Oracle 12 supports SQL syntax for this:

https://oracle-base.com/articles/12c/row-limiting-clause-for-top-n
-queries-12cr1

{{{
[ OFFSET offset { ROW | ROWS } ]
[ FETCH { FIRST | NEXT } [ { rowcount | percent PERCENT } ]
{ ROW | ROWS } { ONLY | WITH TIES } ]
}}}

This applies to all versions, but is probably reasonable to implement in
2.0+ onlyas then there is no need to worry about Oracle 11 which does not
support the syntax.

--
Ticket URL: <https://code.djangoproject.com/ticket/28670>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 3, 2017, 2:49:53 AM10/3/17
to django-...@googlegroups.com
#28670: django/db/backends/oracle/compiler.py handling of LIMIT+OFFSET could be
better in Oracle 12+.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: master
(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 felixxm):

* version: 2.0 => master
* stage: Unreviewed => Accepted


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

Django

unread,
Oct 3, 2017, 2:15:44 PM10/3/17
to django-...@googlegroups.com
#28670: Add native LIMIT/OFFSET support on Oracle.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: felixxm
Type: | Status: assigned

Cleanup/optimization |
Component: Database layer | Version: master
(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 felixxm):

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


--
Ticket URL: <https://code.djangoproject.com/ticket/28670#comment:2>

Django

unread,
Oct 4, 2017, 2:25:03 PM10/4/17
to django-...@googlegroups.com
#28670: Add native LIMIT/OFFSET support on Oracle.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: felixxm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: master
(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 GitHub <noreply@…>):

In [changeset:"03da070f5cfda592a174f8c19349638656a521b2" 03da070]:
{{{
#!CommitTicketReference repository=""
revision="03da070f5cfda592a174f8c19349638656a521b2"
Refs #28670 -- Moved LIMIT/OFFSET SQL to
DatabaseOperations.limit_offset_sql().

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28670#comment:3>

Django

unread,
Oct 6, 2017, 1:10:26 PM10/6/17
to django-...@googlegroups.com
#28670: Add native LIMIT/OFFSET support on Oracle.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: felixxm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/9204 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/28670#comment:4>

Django

unread,
Oct 9, 2017, 9:34:21 AM10/9/17
to django-...@googlegroups.com
#28670: Add native LIMIT/OFFSET support on Oracle.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: felixxm
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
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 Tim Graham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/28670#comment:5>

Django

unread,
Oct 9, 2017, 12:07:19 PM10/9/17
to django-...@googlegroups.com
#28670: Add native LIMIT/OFFSET support on Oracle.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: felixxm
Type: | Status: closed

Cleanup/optimization |
Component: Database layer | Version: master
(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 GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"0899d583bdb140910698d00d17f5f1abc8774b07" 0899d583]:
{{{
#!CommitTicketReference repository=""
revision="0899d583bdb140910698d00d17f5f1abc8774b07"
Fixed #28670 -- Added FETCH/OFFSET support on Oracle.

Thanks Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28670#comment:6>

Django

unread,
Dec 10, 2018, 7:57:08 AM12/10/18
to django-...@googlegroups.com
#28670: Add native LIMIT/OFFSET support on Oracle.
-------------------------------------+-------------------------------------
Reporter: Markus Stenberg | Owner: felixxm
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: master
(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
-------------------------------------+-------------------------------------

Comment (by GitHub <noreply@…>):

In [changeset:"f0082b9a77b76e5fe10a49474d93c3f80a30b928" f0082b9]:
{{{
#!CommitTicketReference repository=""
revision="f0082b9a77b76e5fe10a49474d93c3f80a30b928"
Refs #28670 -- Fixed
DatabaseFeatures.supports_slicing_ordering_in_compound on Oracle.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28670#comment:7>

Reply all
Reply to author
Forward
0 new messages