Opened 8 months ago

Last modified 5 months ago

#27995 assigned Cleanup/optimization

Raise a descriptive error on unsupported operations following QuerySet.union(), intersection(), and difference()

Reported by: Tim Graham Owned by: kapil garg
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation for QuerySet.union() says, "In addition, only LIMIT, OFFSET, and ORDER BY (i.e. slicing and order_by()) are allowed on the resulting QuerySet.", however, there isn't any strict enforcement about this -- some operations like QuerySet.count() might appear to work. See #27982 and #27990 for confusion about this.

Change History (3)

comment:1 Changed 8 months ago by Tim Graham

WIP PR from Florian.

comment:2 Changed 8 months ago by kapil garg

Owner: changed from nobody to kapil garg
Status: newassigned

comment:3 Changed 5 months ago by Tim Graham

Summary: Raise a descriptive error on unsupported operations following QuerySet.union()Raise a descriptive error on unsupported operations following QuerySet.union(), intersection(), and difference()

I closed #28328 as a duplicate -- the case of trying to use only() after difference.

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