Django

Code

Ticket #6956 (closed: fixed)

Opened 6 months ago

Last modified 6 months ago

Subqueries don't use custom queryset

Reported by: i_i Assigned to: nobody
Milestone: Component: Database layer (models, ORM)
Version: queryset-refactor Keywords:
Cc: ivan.illarionov@gmail.com Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

All classes in django/db/models/sql/subqueries.py 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/subqueries.py should sublass from backend-specific Query class the same way QuerySet? class does.

Attachments

sample-fix.txt (3.1 kB) - added by i_i on 04/04/08 06:15:15.
The fix extracted from external backend implementation

Change History

04/04/08 06:15:15 changed by i_i

  • attachment sample-fix.txt added.

The fix extracted from external backend implementation

04/04/08 06:32:28 changed by i_i

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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.

04/13/08 20:14:53 changed by mtredinnick

  • stage changed from Unreviewed to Accepted.

04/15/08 21:58:00 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(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.

04/15/08 21:58:26 changed 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.


Add/Change #6956 (Subqueries don't use custom queryset)




Change Properties
Action