[Django] #30532: Feature request: union queryset should raise on filter

4 views
Skip to first unread message

Django

unread,
May 30, 2019, 4:02:13 PM5/30/19
to django-...@googlegroups.com
#30532: Feature request: union queryset should raise on filter
-----------------------------------------+------------------------
Reporter: cgthayer | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/30532>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 30, 2019, 4:19:12 PM5/30/19
to django-...@googlegroups.com
#30532: Union queryset should raise on filter() and exclude().
-------------------------------------+-------------------------------------
Reporter: cgthayer | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* type: Uncategorized => Cleanup/optimization
* component: Uncategorized => Database layer (models, ORM)
* version: 2.2 => master
* resolution: => duplicate


Comment:

Yes `filter()` and `exclude()` are unsupported but doesn't raise an error
yet. As
​[https://docs.djangoproject.com/en/stable/ref/models/querysets/#union 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/30532#comment:1>

Reply all
Reply to author
Forward
0 new messages