Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#6956 closed (fixed)

Subqueries don't use custom queryset

Reported by: i_i Owned by: nobody
Component: Database layer (models, ORM) Version: queryset-refactor
Severity: Keywords:
Cc: ivan.illarionov@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


All classes in django/db/models/sql/ subclass directly from Query class even if database backend has uses_custom_queryset feature. This makes as_sql() methods of these classes handle limits incorrectly with backends (eg oracle) that use different constructs.

Classes in django/db/models/sql/ should sublass from backend-specific Query class the same way QuerySet class does.

Attachments (1)

sample-fix.txt (3.1 KB) - added by i_i 8 years ago.
The fix extracted from external backend implementation

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by i_i

The fix extracted from external backend implementation

comment:1 Changed 8 years ago by i_i

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Proposal: since all features used by custom QuerySet class were moved to Query class in qsrf branch it makes sense to rename uses_custom_queryset feature to uses_custom_query and make only the Query class customizable. QuerySet class could check for this feature and create its query attribute based on it.

comment:2 Changed 7 years ago by mtredinnick

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [7426]) queryset-refactor: Querysets no longer need to be customised per-backend.
Instead, it's the Query class that is backend-dependent. So make that explicit
in the code (code should refer to sql.Query and they will always get the right
backend-specific class).

This also fixes the main part of #6956, in that the various subclasses of Query
automatically use any custom Query class.

Fixed #6956.

comment:4 Changed 7 years ago by mtredinnick

(In [7427]) queryset-refactor: The Oracle changes necessary for [7426]. I can't test these
at the moment, but they should be close to correct.

Refs #6956.

Note: See TracTickets for help on using tickets.
Back to Top