Opened 9 years ago
Closed 6 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 , 9 years ago
comment:3 by , 8 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 , 7 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.10 → master |
I closed #30456 as an invalid -- the case of trying to use select_related() after union().
comment:5 by , 6 years ago
I closed #30532 as a duplicate -- the case of trying to use filter() and exclude() after union().
comment:6 by , 6 years ago
| Has patch: | set |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
WIP PR from Florian.