Opened 8 years ago

Closed 5 years ago

#27995 closed Cleanup/optimization (fixed)

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

Reported by: Tim Graham Owned by: Hasan Ramezani
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes 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 (6)

comment:1 by Tim Graham, 8 years ago

WIP PR from Florian.

comment:3 by Tim Graham, 7 years ago

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.

comment:4 by Mariusz Felisiak, 6 years ago

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

I closed #30456 as an invalid -- the case of trying to use select_related() after union().

comment:5 by Mariusz Felisiak, 5 years ago

I closed #30532 as a duplicate -- the case of trying to use filter() and exclude() after union().

comment:6 by Hasan Ramezani, 5 years ago

Has patch: set
Owner: changed from nobody to Hasan Ramezani
Status: newassigned
Last edited 5 years ago by Tim Graham (previous) (diff)

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 5 years ago

Resolution: fixed
Status: assignedclosed

In 18533839:

Fixed #27995 -- Added error messages on unsupported operations following union(), intersection(), and difference().

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