Opened 6 years ago

Closed 6 years ago

#30532 closed Cleanup/optimization (duplicate)

Union queryset should raise on filter() and exclude().

Reported by: Charles Thayer Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If a queryset results from a union() it would help to have filter() and exclude() raise instead of return unpredictable results. I propose a _is_union_result bool flag on querysets to track this.

/charles thayer

https://www.google.com/search?q=django+unions+filter+bug+site:stackoverflow.com&sa=X&ved=2ahUKEwiksOCAg8TiAhWBop4KHXPZDMMQrQIoBDAAegQIABAM

Change History (1)

comment:1 by Mariusz Felisiak, 6 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: duplicate
Status: newclosed
Summary: Feature request: union queryset should raise on filterUnion queryset should raise on filter() and exclude().
Type: UncategorizedCleanup/optimization
Version: 2.2master

Yes filter() and exclude() are unsupported but doesn't raise an error yet. As ​per the documentation, "only LIMIT, OFFSET, COUNT(*), ORDER BY, and specifying columns (i.e. slicing, count(), order_by(), and values()/values_list()) are allowed on the resulting QuerySet.".

Duplicate of #27995.

See also a ticket #28519 to support these features.

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